Page 1 of 1

script needs to be reload twice to take in account the changes

Posted: 04 Apr 2019, 10:15
by partof
In my ahk scripts that stores all my key remapping, I have this little piece of code so that I can easily reload it after I made some edits.

Code: Select all

^+r::    
If WinActive("ahk_shortcuts.ahk") ; this will be called when I run the shortcut when my active window is my script in VS Code
   {
	Send ^s ; send ctrl s
	saved= Saved
	Sleep 1000 
   }
TrayTip Reloaded, %saved% ✔
Sleep 1000
#SingleInstance Force
Reload
return
The problem is that I need to reload my script twice for the edits to be taken in account. For instance, when I modify the title of the TrayTip to "AHK Reloaded", I need 2 reload to see it in the traytip.
Any idea how I can only reload only once ? (without using an external file that store a value, and then when my script start it will check this value and if set to true, then set it to false and reload again).