AutoHotkey Community

It is currently May 27th, 2012, 4:19 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: February 19th, 2010, 5:50 pm 
Offline

Joined: January 29th, 2010, 8:37 pm
Posts: 23
Hi, I am working at multifunction script which have few lines which have to be disabled until i enable that specific function.

Example: I have GUI script with few buttons. One of them is turn on/off specific function.
Code:
~Enter::Suspend, Toggle
~Escape::Suspend, Off
~+r::Suspend, On

So problem is: This Suspend hotkeys are "enabled" at the start of the gui and does not start only when i turn on my function. This example suspend function shoudl be active only when i click on my button which turn on my special function. If i dont click on that it should be inactive.
Is it possible to make it work like that? Only way i know is to make 2 separate scripts which first is GUI and other. Second one would be for my special function which use Suspend functions.

_________________
I am sorry for my bad English. It`s not my native language.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2010, 6:44 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Use the Hotkeycomand to make the Make or disable the Hotkeys when you don't want them.
This is an example of a Hotkey that disables its self
Code:
Hotkey, LButton, Button
Return

Button:
MouseGetPos, VarX, VarY
Hotkey, LButton , Off
MsgBox x=%VarX%, y=%VarY%
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2010, 9:02 pm 
Offline

Joined: January 29th, 2010, 8:37 pm
Posts: 23
I have tryed about hour to make this work with indication you give me. But its "bigger than me". Could you be a bit more specific please? Thank you.

My function is "Multi Box" (for game) which send my command to another inactive windows with same name as main using window id function. So when i want to chat, it suspend my script. It works great but i make multifunction gui for that. And here bug come it shouldnt suspend when i chat and have script running until i start Multibox function, but it does.
Script which you give me could be solution i think but its too hard for me to understand. I am going to make it work tomorrow or at least i will tray to.

Anyway thank you for advice. :wink:

_________________
I am sorry for my bad English. It`s not my native language.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 9:20 am 
Offline

Joined: January 29th, 2010, 8:37 pm
Posts: 23
I think it wont work because its suspend function. So i need another function. Anyway i am still traying to do this way you mention.

manual say:
Code:
Any hotkey/hotstring subroutine whose very first line is Suspend (except "Suspend On") will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON. This allows suspension to be turned off via such a hotkey.

_________________
I am sorry for my bad English. It`s not my native language.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2010, 4:27 pm 
Offline

Joined: January 29th, 2010, 8:37 pm
Posts: 23
Nobody? :cry:

_________________
I am sorry for my bad English. It`s not my native language.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2010, 10:14 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
This code contains 6 Hot keys and one of them turns four of them on and off. 8)
Code:
GoSub OffLab
State=0
z::
MsgBox This hotkey unaffected
Return
a::
Send q
Return
s::
Send w
Return
d::
Send e
Return
f::
Send r
Return
g::
State:=!State
If State
GoSub OnLab
Else
GoSub OffLab
Return

OnLab:
Hotkey, a, On
Hotkey, s, On
Hotkey, d, On
Hotkey, f, On
Return
OffLab:
Hotkey, a, Off
Hotkey, s, Off
Hotkey, d, Off
Hotkey, f, Off
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 6:26 pm 
Offline

Joined: January 29th, 2010, 8:37 pm
Posts: 23
Thank you for your help. :) I still can not belive it was so simple. :D
Here is changed code:
Code:
ButtonStartMultiBox:
State:=!State
If State
GoSub OnLab
Else
GoSub OffLab

OnLab:
Hotkey, Enter, On
Hotkey, Escape, On
Hotkey, +r, On
Return
OffLab:
Hotkey, Enter, Off
Hotkey, Escape, Off
Hotkey, +r, Off
Return

~Enter::Suspend, Toggle      ;toggle chat hotkey
~Escape::Suspend, Off      ;suspend off hotkey
~+r::Suspend, On         ;rewhisper hotkey (suspend on)

But i found problem. This whole suspend sunction is part of my multibox script. If i put function above function in script i cannot use another function of that script. Especially this one.
Code:
#IfWinActive, World of Warcraft

Is there any way how to use both of them at the same time?

_________________
I am sorry for my bad English. It`s not my native language.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Mickers, rbrtryn and 72 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