Compiling three scripts

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
nairnmonster3981
Posts: 10
Joined: 27 Jun 2021, 07:10

Compiling three scripts

Post by nairnmonster3981 » 10 Jun 2023, 03:56

Hi there,

I have two scripts that do point and click on a number of things. They have been run separately, but I now need to have it run as one.

What I am trying to do is have script 1run as a constant loop then script 2 pause script 1, run at the time intervals set then resume script 1 once complete.

I can't for the life of me combine them and get them to run, I tried to have them run at same time thinking that the pause command would work but it does not pause nor does it allow the time based script 2 to run.

Any help would be massively appreciated.

Script #1

Code: Select all

#NoTrayIcon
Loop
{
CoordMode, Mouse,
MouseMove, 80, 15, 5.1, ; TA
Click
CoordMode, Mouse,
MouseMove, 80, 395, 5.1, ; TA
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 80, 435, 5.1, ; TA
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 250, 15, 5.1, ; Dashboard 2
Click
CoordMode, Mouse,
MouseMove, 260, 240, 5.1,
Click
sleep, 3500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 400, 15, 5.1, ; Dashboard 3
Click
CoordMode, Mouse,
MouseMove, 670, 260, 5.1,
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 550, 15, 5.1, ; Dashboard 4
Click
CoordMode, Mouse,
MouseMove, 670, 260, 5.1,
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 700, 15, 5.1, ; Dashboard 5
Click
CoordMode, Mouse,
MouseMove, 670, 260, 5.1,
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 850, 15, 5.1, ; Dashboard 6
Click
CoordMode, Mouse,
MouseMove, 670, 260, 5.1,
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 1000, 15, 5.1, ; Dashboard 7
Click
CoordMode, Mouse,
MouseMove, 670, 260, 5.1,
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 1150, 15, 5.1, ; Dashboard 8
Click
CoordMode, Mouse,
MouseMove, 670, 260, 5.1,
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 1450, 15, 5.1, ; ELARA
Click
sleep, 2500 ; how long to wait after sending up till sending down
CoordMode, Mouse,
MouseMove, 1600, 15, 5.1, ; EBARA
Click
sleep, 2500 ; how long to wait after sending up till sending down
}

+\::pause

Script #2

Code: Select all

#Persistent
SetTimer, Chronos, 60000
SetTimer, Stop, % -1000 * 60 * 60 * 10
SoundBeep, 1500
Chronos:
If A_Min in 00,30
 Run "C:\Autoclicker\TA\0.ahk"
If A_Min in 05,35
 Run "C:\Autoclicker\TA\5.ahk"
Return
Stop:
SetTimer, Chronos, Off
SoundBeep, 1000
Return

0 & 5.ahk
#SingleInstance ForceIgnorePromptOff
#NoTrayIcon
Send, +\
Sleep 5500
CoordMode, Mouse,
MouseMove, 205, 1060, 5.1, ; SAML2
Click
Sleep 500
MouseMove, 658, 859, 25.1,
Click
MouseMove, -300, 0, 25.1, R,
Click
Sleep 5500
Send, +\

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]


nairnmonster3981
Posts: 10
Joined: 27 Jun 2021, 07:10

Re: Compiling three scripts

Post by nairnmonster3981 » 10 Jun 2023, 09:48

Excuse my rudimental thinking, but I assigned pause to a key in script 1, then when script 2 runs at the timed intervals, it runs one of 2 scripts that both start with sending the binding key. But it does not pause.

Script 1 is running on loop, script 2 is running on 00,05 & 30,35 of the hour, it triggers two other other scripts which start with the below. But script two is not firing.

Both script 1 & 2 run fine when run as a single.

Just not sure what I'm missing.

Code: Select all

#SingleInstance ForceIgnorePromptOff
#NoTrayIcon
Send, +\
Sleep 5500
CoordMode, Mouse,
[Mod edit: [code][/code] tags added. Please use them yourself when posting code.]

User avatar
kunkel321
Posts: 1035
Joined: 30 Nov 2015, 21:19

Re: Compiling three scripts

Post by kunkel321 » 10 Jun 2023, 10:21

I'm not an expert, but if you really want to have them as separate ahk files, try modifying the sample code in the help docs that Mike suggested.

If you want to combine them, maybe you can have the autoclicker code as a function, then call that function(?)

Also, I think the CoordMode, Mouse, setting might be sticky? You might not need to assign it to Mouse over and over.

EDIT: Also be careful because you have an endless loop.
EDIT 2: If I'm understanding your post correctly, this may also be relevant:
https://www.autohotkey.com/docs/v1/Hotstrings.htm#remarks
By default, hotstrings are never triggered by keystrokes produced by any AutoHotkey script.
I'm not sure if that applies to hotkeys as well...
ste(phen|ve) kunkel

nairnmonster3981
Posts: 10
Joined: 27 Jun 2021, 07:10

Re: Compiling three scripts

Post by nairnmonster3981 » 10 Jun 2023, 10:25

kunkel321 wrote:
10 Jun 2023, 10:21
I'm not an expert, but if you really want to have them as separate ahk files, try modifying the sample code in the help docs that Mike suggested.

If you want to combine them, maybe you can have the autoclicker code as a function, then call that function(?)

Also, I think the CoordMode, Mouse, setting might be sticky? You might not need to assign it to Mouse over and over.
I'm giving that a bash, so to un-pause would just be repeat the same thing?

Oh I never knew that, thanks will clean it up.

Post Reply

Return to “Ask for Help (v1)”