AutoHotkey Community

It is currently May 27th, 2012, 12:22 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: June 1st, 2005, 4:02 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
Hi,

what about letting the user decide what happens when he clicks the tray-icon? I'd prefer it to just reload the script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2005, 9:42 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
This can be done like so:

Code:
#Persistent  ; Keep this script running until the user selects Exit.
Menu, Tray, NoStandard ; only use this menu
Menu, Tray, Click, 1  ; Remove this line if you prefer double-click vs. single-click.
Menu, Tray, Default, &Reload ; what you define as default is bolded

Reload:
reload
return

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2005, 9:47 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
Hmm... I just added those lines to my standard script file, but that didn't work. What do I have to do?

Sorry for the newbie question 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2005, 9:53 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
http://www.autohotkey.com/docs/commands/Menu.htm ;)

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2005, 10:18 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I fine tuned it a little:

Code:
#Persistent  ; Keep this script running until the user selects Exit.
Menu, Tray, Click, 1  ; Remove this line if you prefer double-click vs. single-click.
Menu, Tray, Add  ; Separator
Menu, Tray, Add, &Reload, Reload
Menu, Tray, Default, &Reload ; what you define as default is bolded
return

Reload:
reload
return

Make sure the menu commands go at or near the top of the script. By contrast, the "Reload:" subroutine should be somewhere under the auto-execute section (or at the bottom of the script).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2005, 10:33 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
Thanks Chris, that was very helpful! After reading the site Serenity gave me for 10 minutes I was still like :shock:

Now everything is fine :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2005, 2:31 am 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
Heh, I cut and pasted that a little too quick. :)

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2005, 3:19 pm 
Offline

Joined: July 4th, 2005, 4:46 am
Posts: 13
Hi, not sure if this is the same topic but I have the Joystick as Mouse script running and I have the problem someone else has. When I unplug it, the mouse cursor goes to the top left. Sometimes when I plug it back in, it goes back to normal and sometimes it just stays that way. The biggest problem is that I no longer have control of the mouse and I have to go into the task manager to end the script before I can use the mouse again. I tried to Suspend the script but it doesn't let me. It can only let me Suspend the Hotkeys.

Is there a way to double click to end the application? Also, is there a way to suspend the script so that when I unplug the joystick, it won't move the cursor allowing me to unsuspend it after I plug it back in?

And my last question is, is there a way I can set a macro to end scripts so I don't have to go to the task manager everytime this error comes up and I can have control over my mouse again?

Thanx :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2005, 2:54 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
One solution is to end the script before unplugging the joystick. But you might also be able to change the script to pause itself automatically whenever the joystick is unplugged. I've not tried it, but the following might work. Beneath the label "WatchJoystick:", add:
Code:
Loop
{
    GetKeyState, JoyName, %JoystickNumber%JoyName
    if JoyName <>
        break  ; Joystick is plugged in, so break out of the loop.
    Sleep 100  ; Otherwise, continue waiting for joystick to get plugged back in.
}


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 17 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