Skip lines on reload

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Skip lines on reload

Post by hemsith14_ » 21 Jan 2022, 16:08

Hey

Is it possible to create a "quick reload" function, meaning that upon "reload", it'll skip the auto excecated lines at the beginning of a script?

Thanks

User avatar
mikeyww
Posts: 26932
Joined: 09 Sep 2014, 18:38

Re: Skip lines on reload

Post by mikeyww » 21 Jan 2022, 16:59

You could run the script with a command-line parameter and then check that parameter to see whether to run the auto-exec.

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Skip lines on reload

Post by hemsith14_ » 21 Jan 2022, 17:15

Do you mind giving me an example?

User avatar
mikeyww
Posts: 26932
Joined: 09 Sep 2014, 18:38

Re: Skip lines on reload

Post by mikeyww » 21 Jan 2022, 17:46

Code: Select all

#SingleInstance Force      ; Run AutoHotkey.exe with command-line parameters: [script.ahk] /auto
If (A_Args.1 != "/auto") { ; Reloaded
 Gosub, Show
 Return
}
AutoExec:                  ; Not reloaded
a = 5
Show:
MsgBox, 64, % "Result with parameter = '" A_Args.1 "'", a = %a%`n`nAfter OK, press F4 to reload.
F4::Reload

Post Reply

Return to “Ask for Help (v1)”