Depending on what type of code you are using, like SetTimer
, you might need to put #Persistent
at the top of the script. For more info, check out https://www.autohotkey.com/docs/commands/_Persistent.htm
. In various cases, the script will seem to suddenly "disappear"or won't run, because it needs #Persistent.
If you are saying that the actual script "disappears" and can't be found, then that might be Microsoft Defender or Anti-Virus related. In that case, there are a few things you can do:
Note- There have been other threads like this, so you might want to do a forum search or Google search, to see if those solutions work for you. Example of similar thread, https://www.autohotkey.com/boards/viewtopic.php?t=59598
(Microsoft Defender deleting my apps).
1) Make an exception in Microsoft Defender. It should then ignore the file and let it run normally.
2) Submit a false positive report to Microsoft. Specify "No — this file has been incorrectly detected"
Note- Microsoft will update you on the results of their findings about the files you have submitted. Usually within 24 hours.
Code: Select all
Do you believe this file contains malware?
No — this file has been incorrectly detected
Select the Microsoft security product used to scan the file *
Another possibility is that you are not using authentic AutoHotkey files from this website or the official GitHub, in addition to possibly including other files with your AutoHotkey applications from somewhere else that might be infected. Therefore you need to be very specific about where you got your files from and what is going on, otherwise you can't get the help you need.
Windows Defender will show you what files were put in quarantine or deleted. You can also put the files in a folder, have Windows Defender scan that folder, then look at the results. You can also submit individual files to Virus Total, https://www.virustotal.com/gui/home/upload
, and then see what the results are. Do also feel free to put any negative results here, so the AutoHotkey community can see them as well, and help out.
After making sure the script and any files that it will use are safe, via scan by Windows Defender or other Anti-Virus software. If the program seems to run, but is not doing anything, it might be because it needs administrative rights to interact with other programs on your computer. Add the following code near the top.
Note- This would be a last step, after you made sure the other steps were not an issue.
Code: Select all
If not A_IsAdmin
Run *RunAs "%A_ScriptFullPath%"