Windows 7 to Windows 10: Having to Reload Script

Get help with using AutoHotkey and its commands and hotkeys
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Windows 7 to Windows 10: Having to Reload Script

07 Mar 2019, 08:52

Since my recent conversion from Windows 7 to Windows 10 I'm finding that occasionally I'm having to reload my script to get my shortcuts running again. This happens maybe once a day or so. This never happened to me in Windows 7. Is there some fix for this? Do others have the same problem?
User avatar
sinkfaze
Posts: 613
Joined: 01 Oct 2013, 08:01

Re: Windows 7 to Windows 10: Having to Reload Script

07 Mar 2019, 13:06

That's hard for us to determine if we can't see your script, can you share it?
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Re: Windows 7 to Windows 10: Having to Reload Script

08 Mar 2019, 08:21

It's all very simple, just shortcuts. One had an asterisk in it by mistake (ggg), so I'm removing it, but here it is, with the actual simple text redacted after the shortcuts:

Code: Select all

::ojs::
::o3s::
::o3su::
::jss::
::acnu::
::acnpw::
::jsp::
::occfsc::
:*:ggg::
::eee::
::osc::
::occfsc::
::j.s::

::encryptemail::*** For your security this email and all of its attachments have been encrypted ***
::qqq::*** For your security this email and all of its attachments have been encrypted ***
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Re: Windows 7 to Windows 10: Having to Reload Script

11 Mar 2019, 07:58

Does anyone have any ideas on this? Is there a workaround?
User avatar
sinkfaze
Posts: 613
Joined: 01 Oct 2013, 08:01

Re: Windows 7 to Windows 10: Having to Reload Script

11 Mar 2019, 09:33

I can run those hotstrings on my Windows 10 machine without any issue. Are you running your script as administrator?
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Re: Windows 7 to Windows 10: Having to Reload Script

11 Mar 2019, 15:45

Well, I'm a local admin on my machine. Keep in mind that these work work of the time, but I simply have to reload them at other times. So 95% of the time the script is fine, the other 5% I have to reload it.
iPhilip
Posts: 417
Joined: 02 Oct 2013, 12:21

Re: Windows 7 to Windows 10: Having to Reload Script

11 Mar 2019, 17:52

You might try putting a SendInput after the second pair of colons. You might also want to log their use so that you can see which hotstring is causing the problem.
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Re: Windows 7 to Windows 10: Having to Reload Script

20 Apr 2019, 10:04

At this point I don't think it's a Windows 10 issue or a problem with any of my script. I have to believe some other program I'm running is conflicting with AutoHotkey, but I haven't isolated what it might be. It happens every few days or so and I have many machines and this is the only one it's happening with.

I guess what I'd like is simply something that would cause the reload script to happen, maybe every 30 minutes or so. If it's something I could run with task scheduler that would be fine too. Is there a way to issue the "Reload this Script" from a batch command? Any other ideas?
Odlanir
Posts: 525
Joined: 20 Oct 2016, 08:20

Re: Windows 7 to Windows 10: Having to Reload Script

20 Apr 2019, 11:03

You can put this at the end of your script

Code: Select all

min := 30*60
SetTimer, ReloadMe, 1000
return

ReloadMe:
    if (++cnt > Min)
        Reload
return
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Re: Windows 7 to Windows 10: Having to Reload Script

20 Apr 2019, 11:22

Odlanir wrote:
20 Apr 2019, 11:03
You can put this at the end of your script

Code: Select all

min := 30*60
SetTimer, ReloadMe, 1000
return

ReloadMe:
    if (++cnt > Min)
        Reload
return
I'll put it in right now, and thanks. I obviously won't know if it fully works until some days have passed, but if it truly reloads every 30 minutes it should work.
User avatar
jeeswg
Posts: 6727
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Windows 7 to Windows 10: Having to Reload Script

20 Apr 2019, 11:34

- Every so often, on Windows 7, I've experienced hotkeys being forgotten, and a reload being required. This can often be due to high CPU load.
- The script can Reload itself, or another script can reload it via a message, or perhaps you could put #SingleInstance force in the script and just reopen the script via the command line.
- To reload a script via a message:
list of AutoHotkey WM_COMMAND IDs (e.g. Reload/Edit/Suspend/ListVars on another script) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=74&t=27824
- For me, the key thing of interest would be if there were a way to *check* if the hotkeys were sill active.

- [EDIT:] A problem with reloading is receiving the 'Could not close...' prompt, a workaround is to close and reopen a script.
avoid 'Could not close the previous instance of this script' warnings - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=59615
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
lexikos
Posts: 6613
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Windows 7 to Windows 10: Having to Reload Script

21 Apr 2019, 18:03

Check KeyHistory after the script stops recognizing hotstrings. If it has stopped recognizing keys, the problem will relate to the keyboard hook. Other programs with keyboard hooks can be one cause. The most recently installed keyboard hook takes precedence.

You can sometimes reinstall the keyboard hook by calling Suspend On followed by Suspend Off, but it won't work if any hotkeys are Suspend-exempt or the hook is required for some other reason, such as #InstallKeybdHook.

I would suggest setting the LowLevelHooksTimeout registry value to a high value for testing (e.g. 1000; 1 second is an excessively long time to process a single keyboard event). If the hook frequently encounters the system timeout, it may be silently disabled by the system. See #IfTimeout for details (but the directive itself is no use here).
1100++
Posts: 47
Joined: 10 Feb 2018, 19:05

Re: Windows 7 to Windows 10: Having to Reload Script

22 Apr 2019, 01:11

Did you use EnableUIAccess on an executable other than AutoHotkey?
js0873
Posts: 7
Joined: 07 Mar 2019, 08:47

Re: Windows 7 to Windows 10: Having to Reload Script

22 Apr 2019, 11:53

Let me give an update. The reload script didn't seem to help. Yesterday I had to reload my script and again today to get things working again.

I'm not sure how to check KeyHistory. The next time it happens I'll try just suspending and turning that off again to see if that allows it to work, vs. a reload.

Here's my impressions: I don't recall this ever happening, AHK not working, once I'm actively using my machine. It only seems to occur once my display has been locked after inactivity, and not every time, but occasionally.

I did install a mouse movement utility a month or so ago, one that initiates a task if the mouse hasn't been moved for 75 minutes in my case. That shouldn't be keyboard related but just to knock that out I've disabled that for now.

Last, I don't know how to use EnableUIAccess on an executable. How would that be done?
SuperFoobar
Posts: 13
Joined: 23 Nov 2018, 15:14

Re: Windows 7 to Windows 10: Having to Reload Script

22 Apr 2019, 21:28

The problem might be no admin access. Right click the AHK exe in program files, and check :Run as admin: in the compatibility tab
lexikos
Posts: 6613
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Windows 7 to Windows 10: Having to Reload Script

23 Apr 2019, 04:34

As general advice, I would recommend not changing the compatibility settings of AutoHotkey.exe. Instead, try the workarounds listed in the FAQ if you think running as admin will help.

As far as Send and hotkeys are concerned, running as admin almost never provides any benefit over running with UI access. Either one will generally only help if the active window is running as admin.

KeyHistory is a command you can call. The documentation also points out that you can access the same functionality via the View menu of the script's main window, which normally opens when you double click the tray icon.

No one was suggesting to use EnableUIAccess on any executable as far as I can tell. I see no reason to use it on "a program other than AutoHotkey", and if someone suggested to use it on AutoHotkey I would direct them to Run with UI Access, which supersedes it (and is also mentioned in the aforementioned FAQ).

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], TAC109 and 39 guests