fenchai wrote:
I dont see what the use of point 3 and 4 is to my problem.
You can't just quit a function any time you want. The purpose of point 3 is to forcefully end the functions running.
As for point 4, (this is actually the first time I've played around with this), which is actually combined with point 3 since it includes reloading the script, this allows you to restart the script and conditionally do something.
Take a look at the following test script:
Code: Select all
#SingleInstance
if A_Args.Length and A_Args[1] = 'RunFunction'
MyFunc()
F1::Run('AutoHotkey.exe /restart ' A_ScriptName ' ' 'RunFunction')
F2::Reload
MyFunc() {
MsgBox('nice')
}
Whether you're running it the first time, reloading it from task tray, or reloading it with
F2,
MyFunc doesn't run. It will only run when reloading the script and passing a parameter specified by my choosing (
'RunFunction') by pressing the
F1 hotkey. This approach would allow you to stop all instances of the function from running (by reloading the script) and calling the
copyCode function when the script starts again.