 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
bric75
Joined: 05 Sep 2006 Posts: 24
|
Posted: Mon Apr 02, 2007 12:47 am Post subject: ifwinactive question |
|
|
I have two different scripts that use the same hotkeys. I believe im supposed to put a ifwinactive in one of the scripts so both can work but i dont know how.
I think its supposed to go in here somewhere
| Code: |
DOC(HwndUM,b)
{
ControlGetText, mode , Button30, ahk_id %HwndUM%
mode:=mode = "fold"
If b = FoldBox
return mode ? "Button30" : "Button31"
else If b = CheckFoldBox
return mode ? "Button31" : "Button32"
}
BetEditDoyle=Edit2
BetButtonDoyle=Button20
CheckButtonDoyle=Button19
FoldButtonDoyle=Button18
FoldBoxDoyle=Button30
FoldBoxPosDoyle=140, 535
CheckFoldBoxDoyle=Button31
CheckFoldBoxPosDoyle=140, 555
CheckBoxDoyle=Button32
CheckBoxPosDoyle=140, 575
BetEditUltimateBet=Edit1
BetButtonUltimateBet=Button51
CheckButtonUltimateBet=Button18
FoldButtonUltimateBet=Button13
FoldShowButtonUltimateBet=Button17
FoldSmallButtonUltimateBet=Button16
FoldBoxUltimateBet=Button29
CheckFoldBoxUltimateBet=Button28
BetPotButtonUltimateBet=Button50
BDC(HwndUM,b)
{
;WinGetText, WinTitle, A
ControlGetText, WinTitle , #327701, ahk_id %HwndUM%
ControlGetText, CH , Button2, ahk_id %HwndUM%
mode:=InStr(WinTitle, "(max 6)") ? 0 : 1
CH:=CH = "View Lobby" ? 1 : 0
;tooltip, % ch " " mode " " b
If b = BetEdit
{
mode1:=CH ? "Edit2" : "Edit3", mode0:=CH ? "Edit3" : "Edit4"
return mode ? "Edit2" : "Edit3"
}
else If b = BetButton
{
mode1:=CH ? "Button5" : "Button6", mode0:=CH ? "Button40" : "Button41"
return mode%mode%
}
else If b = CheckButton
{
mode1:=CH ? "Button6" : "Button7", mode0:=CH ? "Button41" : "Button42"
return mode%mode%
}
else If b = FoldButton
{
mode1:=CH ? "Button3" : "Button4", mode0:=CH ? "Button38" : "Button39"
return mode%mode%
}
else If b = FoldBox
{
mode1:=CH ? "Button12" : "Button13", mode0:=CH ? "Button43" : "Button44"
return mode%mode%
}
else If b = CheckFoldBox
{
mode1:=CH ? "Button11" : "Button12", mode0:=CH ? "Button42" : "Button43"
return mode%mode%
}
; BetEditBoDog=Edit2
; BetButtonBoDog=Button5
; CheckButtonBoDog=Button6
; FoldButtonBoDog=Button3
; FoldBoxBoDog=Button12
; CheckFoldBoxBoDog=Button11
} |
|
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Mon Apr 02, 2007 1:14 am Post subject: |
|
|
your best bet is to put a #ifwinactive at the beginning of one of the scripts, then the whole script will only apply when that particular window is active.
a regular ifwinactive will work too, but you may need to put alot of them in your script _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
bric75
Joined: 05 Sep 2006 Posts: 24
|
Posted: Mon Apr 02, 2007 1:50 am Post subject: |
|
|
| i put em all over the script. they didnt do anything |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Mon Apr 02, 2007 4:40 am Post subject: |
|
|
can you post your whole script? or one example of a certain hotkey from each? just enough for us to run and test.
what window do you want what key to activate with? _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Helpy Guest
|
Posted: Mon Apr 02, 2007 10:46 am Post subject: |
|
|
| To enforce the answer of engunneer, be aware of the difference between #IfWinActive directive (applies on next hotkeys) and IfWinActive command which is a test and applies on commands below. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Apr 02, 2007 1:39 pm Post subject: |
|
|
| Also be aware that if two scripts define the same hotkey, the one that started last will be the only one that can get it. The best thing to try at this point would be to merge the scripts or choose a different hotkey for one of them. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|