AutoHotkey Community

It is currently May 24th, 2012, 9:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: ifwinactive question
PostPosted: April 2nd, 2007, 12:47 am 
Offline

Joined: September 5th, 2006, 12:30 am
Posts: 19
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 1:14 am 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
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

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 1:50 am 
Offline

Joined: September 5th, 2006, 12:30 am
Posts: 19
i put em all over the script. they didnt do anything


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 4:40 am 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
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?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 10:46 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 1:39 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, crazyace, engunneer, janopn, Pulover, TheDewd, Xx7, Yahoo [Bot] and 67 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