I have 2 scripts, almost identical, however one of them causes my mouse to get stuck, and it's very difficult to kill the script at that point.
I cannot work out why one of them gets stuck, while the other is fine.
Also, the Exit command does absolutely nothing when it gets stuck.
This is the script that gets stuck: ------------------------------------------
x := 750
y := 150
c := 760
v := 235
ctrl::
{
mousegetpos, start_x, start_y
mouseclick, left, %x%, %y%, 1, 0
sleep, 20
mouseclick, left, %c%, %v%,c 1, 0
mousemove, %start_x%, %start_y%, 0
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Down}
return
}
Esc:: ExitApp
AND THIS SCRIPT RUNS FINE:-----------------------------------------------------
b := 750 ;place your desired coordinates in these two variables.
n := 150
a := 760
s := 210
alt::
{
mousegetpos, start_b, start_n
mouseclick, left, %b%, %n%, 1, 0
sleep, 20
mouseclick, left, %a%, %s%, 1, 0
mousemove, %start_b%, %start_n%, 0
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Left}
sleep, 10
sendInput {Down}
sleep, 25
sendInput {LAlt down}
sendInput {enter}
sendInput {LAlt up}
return
}
Esc:: ExitApp
Script causes mouse to get stuck
-
- Posts: 5
- Joined: 16 Oct 2017, 05:56
-
- Posts: 5
- Joined: 16 Oct 2017, 05:56
Re: Script causes mouse to get stuck
Just for clarification, these scripts just tell the program to click the mouse in certain spots and hit the left and down arrows in a certain sequence, to automate a repetitive task in google sheets.
- divanebaba
- Posts: 804
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: Script causes mouse to get stuck
Hi.
I think that this linestucks your script.
Try it with $-prefix to prevent the hotkey triggering itself.You can add the $-prefix even to your other hotkeys.
EDIT: What is this?I don't find any information about the "c 1" parameter/command.
Maybe this could cause the stuck in your first script.
I think that this line
Code: Select all
sendInput {LAlt down}
Try it with $-prefix to prevent the hotkey triggering itself.
Code: Select all
$Alt::
...
EDIT: What is this?
Code: Select all
mouseclick, left, %c%, %v%,c 1, 0
Maybe this could cause the stuck in your first script.
Last edited by divanebaba on 16 Oct 2017, 06:25, edited 2 times in total.
-
- Posts: 5
- Joined: 16 Oct 2017, 05:56
Re: Script causes mouse to get stuck
Thanks, but that's actually part of the script that runs fine. It's the first script that is having trouble. The one activated by control. I had it working recently, but it suddenly stopped working, and I'm not sure what change caused it.
-
- Posts: 5
- Joined: 16 Oct 2017, 05:56
Re: Script causes mouse to get stuck
I simplified the script, and it still gets stuck. The problem is somewhere here:
x := 750 ;place your desired coordinates in these two variables.
y := 150
c := 760
v := 235
ctrl::
{
mousegetpos, start_x, start_y
mouseclick, left, %x%, %y%, 1, 0
sleep, 20
mouseclick, left, %c%, %v%,c 1, 0
mousemove, %start_x%, %start_y%, 0
return
}
Esc:: ExitApp
x := 750 ;place your desired coordinates in these two variables.
y := 150
c := 760
v := 235
ctrl::
{
mousegetpos, start_x, start_y
mouseclick, left, %x%, %y%, 1, 0
sleep, 20
mouseclick, left, %c%, %v%,c 1, 0
mousemove, %start_x%, %start_y%, 0
return
}
Esc:: ExitApp
Re: Script causes mouse to get stuck
The script works fine, the issue (I presume) is you've made a typo, and then copy & pasted that typo in you're simplified script, and also didn't see divenababa's edit two posts ago regarding this line:
i.e. The clickcount parameter is c 1 which I figure is 7601 clicks, c being 760 and 1 being appended to the end of it, since according to the docs mouseclicks arguments can be expressions.
So it's either a typo (as it doesn't appear like this in your script using alt) and it's not finishing when you expect, or it's intended, so you just have to be more patient and wait for it to complete it's 7601 mouse clicks (which it does do, after a couple of minutes).
Code: Select all
mouseclick, left, %c%, %v%,c 1, 0
So it's either a typo (as it doesn't appear like this in your script using alt) and it's not finishing when you expect, or it's intended, so you just have to be more patient and wait for it to complete it's 7601 mouse clicks (which it does do, after a couple of minutes).
-
- Posts: 5
- Joined: 16 Oct 2017, 05:56
Re: Script causes mouse to get stuck
Ah, so that explains why it would actually stop after a while. That 'c' is a typo, It's only supposed to click once in that step. I hadn't noticed that before. Thanks a lot. All this hassle over a small typo... I guess that's programming in a nutshell, lol.
Who is online
Users browsing this forum: FanaticGuru, Google [Bot], OrangeCat and 129 guests