AutoHotkey Community

It is currently May 24th, 2012, 2:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: October 10th, 2011, 11:51 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
Reloads the script when coming back out of a suspend / hibernate.

This might be useful for instances when hotkeys stop working after a hibernate / suspend. (not had this trouble personally, but I've heard it a few times)

Basic / _L
Code:
; put this in the auto-execute section of the script
OnMessage(0x218, "reloadOnResume")

; put this anywhere
reloadOnResume(wP, lP) {
    if (wP == 7)
        reload
}


_L only, even easier:
Code:
; put this anywhere
reloadOnResume(wP, lP) {
    static init := OnMessage(0x218, "reloadOnResume")
    if (wP == 7)
        reload
}


About: WM_POWERBROADCAST message

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 11th, 2011, 8:11 am 
Nice! I have heard about the problem. A question though: Would it be possible to instead just refresh the hotkeys?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 11th, 2011, 4:33 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
Not that I am aware of. It has to do with the internals of autohotkey, which are pretty much inaccessible from the script-writer's standpoint.

I would suggest separating your hotkeys into a file separate from other code that has startup effects.

Hmm, on second thought, if you implemented all your hotkeys with the Hotkey command instead of hotkey labels, you might be able to rerun that code instead of reloading the script. (you could just change the reload line to a call to refresh your hotkeys)

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 11th, 2011, 9:50 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
infogulch wrote:
Not that I am aware of. It has to do with the internals of autohotkey, which are pretty much inaccessible from the script-writer's standpoint.

I would suggest separating your hotkeys into a file separate from other code that has startup effects.

Hmm, on second thought, if you implemented all your hotkeys with the Hotkey command instead of hotkey labels, you might be able to rerun that code instead of reloading the script. (you could just change the reload line to a call to refresh your hotkeys)


Yes, your second thought was my first though, and that other post was my post. I have tried using Hotkey command to dynamically change hotkeys even while a script is running, and it has been succesful. I'll try optimizing my script(s) with your snippet, so thanks :)

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], RaptorX, tomoe_uehara and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group