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

Get help with using AutoHotkey and its commands and hotkeys
partof
Posts: 95
Joined: 16 Jan 2016, 08:38

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

04 Apr 2019, 10:15

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).

Return to “Ask For Help”

Who is online

Users browsing this forum: DRocks, whitestar127 and 75 guests