Hello!
I´m learning Autohotkey Script now since maybe 5 years, and every day i learn something new.
Normally i first try all of my knowledge to make a script of my desire without asking.
But this time, i think i must ask this. This actually drived me crazy. I worked on this the whole day and i can´t get it work even if i done a similar thing before.
Okay, first, here is the script:
SetWorkingDir %A_ScriptDir%\TOOLS\Icons\
Gui, Font, s0
Gui +Border +Caption
Gui, Add, Picture, x0 y0 w1010 h590, %A_ScriptDir%\TOOLS\Icons\Background.png
Gui, Font, s13 Bold, Arial
Gui, Add, Picture, BackgroundTrans x380 y180 w250 h70, %A_ScriptDir%\TOOLS\Icons\Button.png
Gui, Add, Text, cFFFFFF BackgroundTrans x405 y205 w200 Center gButton01, YES
Gui, Add, Picture, BackgroundTrans x380 y340 w250 h70, %A_ScriptDir%\TOOLS\Icons\Button.png
Gui, Add, Text, cFFFFFF BackgroundTrans x405 y365 w200 Center gButton02, NO
Gui, +Owner
Gui, Show, ,Do You Want To Launch The Program?
Wait(5000)
Wait(time)
{
static MyProgress
tick:=A_TickCount+time
Gui, Margin,0,0
Gui, Add, Progress, x355 y280 w300 h20 cgreen -smooth Range%A_TickCount%-%tick% vMyProgress
Gui, Show, NA
While A_TickCount<=tick
{
GuiControl,,MyProgress,% A_TickCount
Sleep 16
}
Gui, Destroy
}
Return
Button01:
Gui, Destroy
Goto, PROGRAM01
Return
Button02:
Gui, Destroy
Goto, PROGRAM02
Return
GuiClose:
Gui, Destroy
I should explain what i want from this script.
This should be a GUI for a program. When you launch it, it asks if you want to launch "PROGRAM01". It gives you a timer to answer yes or no.
When pressing the button "Yes", it launches "PROGRAM01". When pressing the button "No", it won´t launch "PROGRAM01", but instead launches "PROGRAM02". When not pressing any button in the timed Countdown, it then automaticly launches still "PROGRAM01".
My problem with this?
For whatever reason, even when pressing "No", so it should launches "PROGRAM02", it still launches "PROGRAM01".
I did something similar before and now i can´t get it working anymore. I don´t get it.
I think the problem lies in the countdown timer. It won´t stop regardless i press "PROGRAM02" or close the GUI.
Thanks everyone for any help.
Problems in a GUI with Countdown Script
Re: Problems in a GUI with Countdown Script
Your code is not complete. As such, it's not doing anything.
Maybe you'd like to share it with us?
Maybe you'd like to share it with us?
Re: Problems in a GUI with Countdown Script
I won´t post the complete script, because it´s way too big.
Anyways here is a simplified script of it, the only thing missing is the PNG´s, but it´s working without it.
SetWorkingDir %A_ScriptDir%\TOOLS\Icons\
Gui, Font, s0
Gui +Border +Caption
Gui, Add, Picture, x0 y0 w1010 h590, %A_ScriptDir%\TOOLS\Icons\Background.png
Gui, Font, s13 Bold, Arial
Gui, Add, Picture, BackgroundTrans x380 y180 w250 h70, %A_ScriptDir%\TOOLS\Icons\Button.png
Gui, Add, Text, cFFFFFF BackgroundTrans x405 y205 w200 Center gButton01, YES
Gui, Add, Picture, BackgroundTrans x380 y340 w250 h70, %A_ScriptDir%\TOOLS\Icons\Button.png
Gui, Add, Text, cFFFFFF BackgroundTrans x405 y365 w200 Center gButton02, NO
Gui, +Owner
Gui, Show, ,Do You Want To Launch The Program?
Wait(5000)
Wait(time)
{
static MyProgress
tick:=A_TickCount+time
Gui, Margin,0,0
Gui, Add, Progress, x355 y280 w300 h20 cgreen -smooth Range%A_TickCount%-%tick% vMyProgress
Gui, Show, NA
While A_TickCount<=tick
{
GuiControl,,MyProgress,% A_TickCount
Sleep 16
}
Gui, Destroy
}
Return
Button01:
Gui, Destroy
Goto, PROGRAM01
Return
Button02:
Gui, Destroy
Goto, PROGRAM02
Return
GuiClose:
Gui, Destroy
;###################################################################################################################
PROGRAM01:
;###################################################################################################################
Run, C:\Windows\regedit.exe
Return
;###################################################################################################################
PROGRAM02:
;###################################################################################################################
Run, C:\Windows\System32\SndVol.exe
Return
ExitApp
Anyways here is a simplified script of it, the only thing missing is the PNG´s, but it´s working without it.
SetWorkingDir %A_ScriptDir%\TOOLS\Icons\
Gui, Font, s0
Gui +Border +Caption
Gui, Add, Picture, x0 y0 w1010 h590, %A_ScriptDir%\TOOLS\Icons\Background.png
Gui, Font, s13 Bold, Arial
Gui, Add, Picture, BackgroundTrans x380 y180 w250 h70, %A_ScriptDir%\TOOLS\Icons\Button.png
Gui, Add, Text, cFFFFFF BackgroundTrans x405 y205 w200 Center gButton01, YES
Gui, Add, Picture, BackgroundTrans x380 y340 w250 h70, %A_ScriptDir%\TOOLS\Icons\Button.png
Gui, Add, Text, cFFFFFF BackgroundTrans x405 y365 w200 Center gButton02, NO
Gui, +Owner
Gui, Show, ,Do You Want To Launch The Program?
Wait(5000)
Wait(time)
{
static MyProgress
tick:=A_TickCount+time
Gui, Margin,0,0
Gui, Add, Progress, x355 y280 w300 h20 cgreen -smooth Range%A_TickCount%-%tick% vMyProgress
Gui, Show, NA
While A_TickCount<=tick
{
GuiControl,,MyProgress,% A_TickCount
Sleep 16
}
Gui, Destroy
}
Return
Button01:
Gui, Destroy
Goto, PROGRAM01
Return
Button02:
Gui, Destroy
Goto, PROGRAM02
Return
GuiClose:
Gui, Destroy
;###################################################################################################################
PROGRAM01:
;###################################################################################################################
Run, C:\Windows\regedit.exe
Return
;###################################################################################################################
PROGRAM02:
;###################################################################################################################
Run, C:\Windows\System32\SndVol.exe
Return
ExitApp
Re: Problems in a GUI with Countdown Script
Code: Select all
Gui, Font, s0
Gui +Border +Caption
Gui, Font, s13 Bold, Arial
Gui, Add, Text, x405 y205 w200 Center gButton01, YES
Gui, Add, Text, x405 y365 w200 Center gButton02, NO
Gui, +Owner
Gui, Show, ,Do You Want To Launch The Program?
Wait(5000)
Wait(time)
{
static MyProgress
tick:=A_TickCount+time
Gui, Margin,0,0
Gui, Add, Progress, x235 y280 w300 h20 cgreen -smooth Range%A_TickCount%-%tick% vMyProgress
Gui, Show, NA
While A_TickCount<=tick
{
GuiControl,,MyProgress,% A_TickCount
Sleep 16
}
Gui, Destroy
}
Return
Button01:
Gui, Destroy
Goto, PROGRAM01
Return
Button02:
Gui, Destroy
Goto, PROGRAM02
Return
GuiClose:
Gui, Destroy
Return
PROGRAM01:
MsgBox 01
Return
PROGRAM02:
MsgBox 02
Return
pressing YES, launches PROGRAM01
pressing NO, launches PROGRAM02
not doing anything, doesnt do anything
Re: Problems in a GUI with Countdown Script
If my post would actually be approved, i could shown a more correct script. But right now i have to wait.
Edit:
where is my post?
Edit:
where is my post?
Who is online
Users browsing this forum: doodles333, Google [Bot] and 305 guests