AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Control Button on 2nd GUI window does not work.

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Muzzi



Joined: 15 Jun 2008
Posts: 65
Location: east coast of Australia

PostPosted: Thu Jul 17, 2008 4:45 am    Post subject: Control Button on 2nd GUI window does not work. Reply with quote

Dear Mr Auto (not so) Hot King,

I found a problem when you place a button onto a second GUI. Basically it doesnt work no matter what call command you place under it it just doesnt happen.

I have 5 buttons on 1 GUI which work great but when I created a seperate button on a second GUI it didnt work.. I was stumped... couldnt figure it out for hours... it was driving me insane....Till I placed it on the first GUI interface and it worked straight away... Voila! Ahaha My madness had fled and before I new it I was back on the road again with vengeance.


Here's the extract from my script that did not work.



Code:
WAMask:
Winset, Transcolor, 000000 192, wintitle
Gui 1:-Caption
Gui 1:+AlwaysOnTop
Gui 1:Color, 000000
Gui 1:Submit, nohide
Gui 1:Font, S16 cRed Bold , Tahoma
Gui 1:Add, Button, x120 y15 w90 h35, FWD>
Gui 1:Font, S16 cRed Bold , Tahoma
Gui 1:Add, Button, x25 y15 w90 h35, <BACK
Gui 1:Font, S18 cRed Bold , Tahoma
Gui 1:Add, Button, x215 y8 w180 h50, PLAYpause
Gui 1:Font, S18 cRed Bold , Tahoma
Gui 1:Add, Button, x400 y15 w90 h35, STOP
Gui 1:Font, S18 cRed Bold , Tahoma
Gui 1:Add, Button, x666 y15 w150 h35, VISUALS
Gui 1:Show, x1280 y-1 h65 w850

Gui 3:-Caption
Gui 3:+AlwaysOnTop
Gui 3:Color, 000000
Gui 3:Font, S100 cblack, Tahoma
Gui 3:Add, Button, x0 y0 w1281 h1025, "DON'T_TOUCH!"
Gui 3:Show, x-1 y-1 h1025 w1281  ; full left screen mask

;; there is other GUI script here.......

Gui 4:-Caption
Gui 4:+AlwaysOnTop
Gui 4:Color, 000000
Gui 4:Font, S16 cWhite Bold , Tahoma
Gui 4:Add, Text, x50 y7, Playlist
Gui 4:Font, S11 cblack, Tahoma
Gui 4:Add, Button, x220 y10 w170 h25, CLEAR   ; <<Here's the culprit!
Gui 4:Show, x2128 y-1 h42 w432  ; top right of screen mask

;; there is other GUI script here as well.



ButtonPLAYpause:
DetectHiddenWindows, On
Target := "ahk_class Winamp v1.x"
IfWinNotExist %Target%
{
Run "%ProgramFiles%\Winamp\Winamp.exe"
WinWait, %Target%
}
SendMessage, 1024, 0, 104
WinampPlayStatus := ErrorLevel
If( WinampPlayStatus == 0 )
{
WinWait, Media Library,
IfWinNotActive, Media Library, , WinActivate, Media Library,
WinWaitActive, Media Library,
Send, {Enter}
}
else
{
ControlSend, ahk_parent, c  ; Pause
}
return

buttonFWD>:
DetectHiddenWindows, On
Target := "ahk_class Winamp v1.x"
IfWinNotExist %Target%
{
Run "%ProgramFiles%\Winamp\Winamp.exe"
WinWait, %Target%
}
SendMessage, 1024, 0, 104
WinampPlayStatus := ErrorLevel
If( WinampPlayStatus == 1 )
{
ControlSend, ahk_parent, b  ; Next track
}
return

button<BACK:
DetectHiddenWindows, On
Target := "ahk_class Winamp v1.x"
IfWinNotExist %Target%
{
Run "%ProgramFiles%\Winamp\Winamp.exe"
WinWait, %Target%
}
SendMessage, 1024, 0, 104
WinampPlayStatus := ErrorLevel
If( WinampPlayStatus == 1 )
{
ControlSend, ahk_parent, z  ; previous track
}
return

buttonSTOP:
DetectHiddenWindows, On
Target := "ahk_class Winamp v1.x"
IfWinNotExist %Target%
{
Run "%ProgramFiles%\Winamp\Winamp.exe"
WinWait, %Target%
}
SendMessage, 1024, 0, 104
WinampPlayStatus := ErrorLevel
If( WinampPlayStatus == 1 )
{
ControlSend, ahk_parent, v  ; stop
}
return

buttonVISUALS:
DetectHiddenWindows, On
Target := "ahk_class Winamp v1.x"
IfWinNotExist %Target%
{
Run "%ProgramFiles%\Winamp\Winamp.exe"
WinWait, %Target%
}
SendMessage, 1024, 0, 104
WinampPlayStatus := ErrorLevel
If( WinampPlayStatus == 1 )
{
ControlSend, ahk_parent, ^+k  ; visuals
}
return

;; The below script is what had me stumped for hours.. it just would not work!

ButtonCLEAR:
DetectHiddenWindows, On
Target := "ahk_class Winamp v1.x"
IfWinNotExist %Target%
{
Run "%ProgramFiles%\Winamp\Winamp.exe"
WinWait, %Target%
}
SendMessage, 1024, 0, 104   
WinampPlayStatus := ErrorLevel
If( WinampPlayStatus == 0 )
{
WinWait, Playlist Editor,
IfWinNotActive, Playlist Editor, , WinActivate, Playlist Editor,
WinWaitActive, Playlist Editor,
Send, {CTRL}{SHIFT}{DEL}
}
return



ps... If I missed something I would love to know.
_________________
̊˳ɱטᶚᶚї˳̊


Last edited by Muzzi on Thu Jul 17, 2008 6:12 am; edited 1 time in total
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1219
Location: USA

PostPosted: Thu Jul 17, 2008 5:06 am    Post subject: Reply with quote

well, you dont have DONT_TOUCH as a label name and you are not using a glabel.

i am also relatively sure that the title of the window is not "v1.x" (with the x)
_________________
Back to top
View user's profile Send private message
Muzzi



Joined: 15 Jun 2008
Posts: 65
Location: east coast of Australia

PostPosted: Thu Jul 17, 2008 6:18 am    Post subject: Reply with quote

Quote:
well, you dont have DONT_TOUCH as a label name and you are not using a glabel.


Cheers for that.. I put a block on these whilst I was running some tests.

Quote:
i am also relatively sure that the title of the window is not "v1.x" (with the x)


They work fine for me on all the other buttons..
_________________
̊˳ɱטᶚᶚї˳̊
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 904
Location: London, UK

PostPosted: Thu Jul 17, 2008 2:48 pm    Post subject: Reply with quote

The Helpfile wrote:
If a button lacks an explicit g-label, an automatic label is assumed. For example, if the first GUI window contains an OK button, the ButtonOK label (if it exists) will be launched when the button is pressed. For GUI windows other than the first, the window number is included in front of the button's automatic label; for example: 2ButtonOK.


In other words the label should be 4ButtonCLEAR

*tested and working with the above label.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group