Dear all,
Since recent times (hidden Win 10 update?) a script does not work after wakeup from hibernation.
The scipt sets up a large number of hot strings, which all are invokes via a 'trigger character'.
Since this happens I need to reload the script (which isin storage and the icon is in the tray).
Operating system: 10.0.18363 64 bit en
Script not working after wakeup from hibernation
Re: Script not working after wakeup from hibernation
Script(s) running in Admin-mode?
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
Re: Script not working after wakeup from hibernation
I think it is not in admin mode - because it has not introction such as the following
What I do not understand is the fact, that it worked until recently (beinning of april) also after hibernation. BTW in my log the resume code is not in all cases the same:
The problem occurs If resume code is 7 (without the following 18).
In both cases I just hit the power button to revive windows - I have no clue why this creates different resume codes depending on the type of hibernation (suspend 4). Maybe I do not log the complete sleep condition...
Code: Select all
#SingleInstance Force
if !A_IsAdmin ; must be first in script (see H:\Utilities\DDDutils\Test-ahks\Run-as-admin.ahk)
{ ; see *verb in AHK help --- here the context-menu Run as Administrator
try Run *RunAs "%A_ScriptFullPath%"
catch
MsgBox, You clicked Cancel when asked to elevate the script`nPlease Run this again with admin rights.
ExitApp
}
Code: Select all
Wed 2020-04-15 09:07:28 Starting 361 ; ;
Wed 2020-04-15 12:47:03 ; ; Force hibernate
Wed 2020-04-15 12:47:09 ; ; Suspend 4
Wed 2020-04-15 14:29:24 ; ; Resume 7
Wed 2020-04-15 15:09:50 Logging ; ; Since a while (2 weeks?) AHK script ShortHand does not work after wake up from hibernation a
Wed 2020-04-15 15:47:38 ; ; Suspend 4
Wed 2020-04-15 17:25:46 ; ; Resume 7
Wed 2020-04-15 17:25:46 ; ; Resume 18
In both cases I just hit the power button to revive windows - I have no clue why this creates different resume codes depending on the type of hibernation (suspend 4). Maybe I do not log the complete sleep condition...
Klaus Daube, Zürich, CH
Re: Script not working after wakeup from hibernation
I have now introduced the script with this code:
It seems that this cured the problem - thanks BNOLI for the hint!
Code: Select all
#SingleInstance Force
if !A_IsAdmin { ; must be first in script ; see *verb in AHK help --- here the context-menu Run as Administrator
try Run *RunAs "%A_ScriptFullPath%"
catch
MsgBox, You clicked Cancel when asked to elevate the script`nPlease Run this again with admin rights.
ExitApp
} ;
Klaus Daube, Zürich, CH
Re: Script not working after wakeup from hibernation
... seems to help only for resume 10, but not resume 7
PBT_APMRESUMESUSPEND 0x0007 resuming from a low-power state
PBT_APMPOWERSTATUSCHANGE 0x000A e.g. switch from battery to A/C; low b attery
In my case 7 is after 'self-hibernation' (sleeping according to power settings),
10 is after 'forced hibernation' (PBT_APMSUSPEND 0x0004 typically broadcast when all applications and installable drivers have returned TRUE to a previous PBT_APMQUERYSUSPEND event).
Well, it's not that a drama, because script can be reloaded via system tray - but not elegant.
PBT_APMRESUMESUSPEND 0x0007 resuming from a low-power state
PBT_APMPOWERSTATUSCHANGE 0x000A e.g. switch from battery to A/C; low b attery
In my case 7 is after 'self-hibernation' (sleeping according to power settings),
10 is after 'forced hibernation' (PBT_APMSUSPEND 0x0004 typically broadcast when all applications and installable drivers have returned TRUE to a previous PBT_APMQUERYSUSPEND event).
Well, it's not that a drama, because script can be reloaded via system tray - but not elegant.
Klaus Daube, Zürich, CH
Who is online
Users browsing this forum: AHK_user and 202 guests