1

I was working on an AutoHotKey (AHK) script to create prefab mouse movements for a very simple model viewer. I worked on it for a good hour. I zipped the script, posted it to a forum, and thought "oh hey, I should add bla bla bla to the script".

When I returned to the program, the AHK script would not work. I could see the mouse movements working in other programs (notepad, chrome, etc), but not where I had been working the previous hour.

After several hours of throwing darts at the troubleshooting wall, I discovered that the fix was to set the AHK.exe to Run as Administrator.

The question here are multiple

  1. Why did Windows 7, in all it's wisdom, suddenly decide that elevation was necessary in the middle of usage?
    • Can these permission requirements somehow be reverted by, say, removing a key from the registry or something?
  2. How can this kind of Windows behaviour be avoided in the future?
0

You can try to make your script(s) run as Admin

if not A_IsAdmin
 {
  Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
  ExitApp
 }

See http://ahkscript.org/docs/Variables.htm#IsAdmin

or try enabling interaction with administrative programs by using EnableUIAccess:

Modifies AutoHotkey.exe to allow scripts to do the following even while UAC is enabled:
* Interact with windows of administrative programs without running the script as administrator.
* Use SendPlay.
Source: http://www.autohotkey.com/board/topic/70449-enable-interaction-with-administrative-programs/

  • The question is not "how can I make my script run as admin". The question is "why did AHK.exe suddenly need admin privileges". As said, it was working without privs, then suddenly it needed the privs. – monsto Feb 4 '15 at 23:21
  • It tries to answer "how can this be avoided in future" part. There could be many reasons for the change, including updates of the OS or other software on your computer - something that would be impossible to answer without detailed information. Are you sure you didn't run AHK as administrator at first, or perhaps the model viewer is now run as Admin while first it wasn't? – lintalist Feb 8 '15 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.