Page 1 of 1
Rookie Autohotkey ???
Posted: 21 Jun 2014 16:53
by Regmos
Hi.
Very poor "
scripter" relying on the expertise in this brilliant forum
I have made a simpel AHK script that launches a few programs including
SUMo which starts and performs an update check.
Code: Select all
run "C:\Program Files\XYplorer\XYplorer.exe" /win=min
sleep 1000
run "C:\Program Files\PhraseExpress\phraseexpress.exe"
sleep 1000
Run "C:\Users\Regmos\AppData\Roaming\Dropbox\bin\Dropbox.exe" /home
Sleep 3000
Run "C:\Users\Regmos\Documents\Portable Apps\sumo\SUMo.exe"
Sleep 20000
send {F5} ; or {Enter} doesn't matter
Is there a way to replace the long "
sleep 20000" and make AHK wait for the "
Kontrollér" (
Check) button to become active (
Server online). The server is not always reliable, and 20 seconds can feel like a long time if it is.
I have tried WinWait and WinWaitActive but i can't figure out what to wait for.
Does anyone know the secret

Re: Rookie Autohotkey ???
Posted: 21 Jun 2014 16:59
by binocular222
Post in AHK forum is better for sure.
Anyway, using AU3_spy.exe, what is the difference between active and inactive state?
It's highly likely that there's no difference, then there're still several ways:
- Search particular pixel in that SUMO window (the statusbar) to see when the "online" word popup
- Check internet connection between SUMO and the internet. I think that when it finnish checking, the connection will cease
- Analyze the data package transfer from server to your computer, which is erh, way beyond my knowledge
Re: Rookie Autohotkey ???
Posted: 21 Jun 2014 17:46
by highend
You're looking for:
ControlGet, OutputVar, Cmd [, Value, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]
Cmd = Enabled
Returns 0 / 1
E.g.
ControlGet, value, Enabled, , TJvImgBtn6, ahk_class TMainDlg
MsgBox, %value%
And for the waiting part...
Code: Select all
SetTimer, CheckSumoButton, 250
return
CheckSumoButton:
ControlGet, value, Enabled, , TJvImgBtn6, ahk_class TMainDlg
if value
; do something
return
Re: Rookie Autohotkey ???
Posted: 21 Jun 2014 18:55
by Regmos
Thanks
I'm working on it and I think I'm beginning to understand a little bit.
I'll be back

Re: Rookie Autohotkey ???
Posted: 22 Jun 2014 14:02
by Regmos
Still struggling. It's a bit harder than I imagined
What i want, is the script to run an update check and close down afterwards. When using the code below, it starts SUMo, the script closes and nothing else happens.
Code: Select all
Run "C:\Users\Regmos\Documents\Portable Apps\sumo\SUMo.exe"
sleep 2000
SetTimer, CheckSumoButton, 250
return
CheckSumoButton:
ControlGet, value, Enabled, , TJvImgBtn6, ahk_class TMainDlg
if 1
send {F5}
return
If I add a shortcut (
+!s
::) or
#Persistent it works like expected, but i keeps looping like a madman, performing update check after update check.
Is there a way to stop that ? I have tried to
Exit, to
ExitApp and putting it to
sleep, but that doesn't work, and I have no idea what else to do

Re: Rookie Autohotkey ???
Posted: 22 Jun 2014 14:17
by bdeshi
Set the timer off after the button is enabled.
Code: Select all
if 1
{
send {F5}
SetTimer, CheckSumoButton, off
}
Disclaimer: just a guess, didn't try. AFK.
EDIT: see binocular222's post below. Didn't notice that if 1 at all!
Re: Rookie Autohotkey ???
Posted: 22 Jun 2014 15:00
by highend
Code: Select all
Run "C:\Users\Regmos\Documents\Portable Apps\sumo\SUMo.exe"
sleep 2000
SetTimer, CheckSumoButton, 250
return
CheckSumoButton:
ControlGet, value, Enabled, , TJvImgBtn6, ahk_class TMainDlg
if 1
send {F5}
return
Why do you still use a sleep command? The timer will do what you need.
Wouldn't it just work to add ExitApp after send{F5}?
Re: Rookie Autohotkey ???
Posted: 22 Jun 2014 15:42
by Regmos
SammaySarkar wrote:Set the timer off after the button is enabled.
Sorry, didn't work.
highend wrote:Why do you still use a sleep command? The timer will do what you need
To give SUMo a chance to appear. If I don't put it to sleep, it seems like the script is looking elsewhere for the "
CheckSumoButton" and the desktop starts flickering.
Wouldn't it just work to add ExitApp after send{F5}?
Unfortunately not. It just terminates the script right after SUMo has started, and nothing else happens.
I think I'll go back to using SUMo the old fashioned way, and click "Kontrollér" with my mouse. Thanks a lot for the effort

Re: Rookie Autohotkey ???
Posted: 22 Jun 2014 16:45
by binocular222
You are almost there. The line "if 1" is blatantly wrong
Code: Select all
Run "C:\Users\Regmos\Documents\Portable Apps\sumo\SUMo.exe"
sleep 2000
SetTimer, CheckSumoButton, 250
return
CheckSumoButton:
ControlGet, OutputVar, Enabled, , TJvImgBtn6, ahk_class TMainDlg
if OutputVar
Sendinput {F5}
Exitapp
Re: Rookie Autohotkey ???
Posted: 22 Jun 2014 18:13
by highend
No need to give up...
Code: Select all
#Persistent
Run "C:\Users\Regmos\Documents\Portable Apps\sumo\SUMo.exe"
SetTimer, CheckSumoButton, 250
return
CheckSumoButton:
ControlGet, value, Enabled, , TJvImgBtn6, ahk_class TMainDlg
if value
{
ControlSend, , {F5}, ahk_class TMainDlg
Exitapp
}
return
Use this. Tested, works. And ofc you don't need the sleep command^^
Re: Rookie Autohotkey ???
Posted: 23 Jun 2014 12:14
by Regmos
highend wrote:...Tested, works...
This is getting weird. Something must be rotten in the state of Denmark.
Your last script starts SUMo and then the script closes. If I remove
ExitApp, it works but keeps looping. Something must be wrong in my end
Thanks a lot for trying, but I think I'll settle for the extra click.
Re: Rookie Autohotkey ???
Posted: 20 May 2015 08:22
by Regmos
I decided to give it another go, and this works.
Code: Select all
run "...previous step..."
Run "C:\Users\Regmos\Documents\Portable Apps\sumo\SUMo.exe"
winwait, SUMo
Loop {
Sleep 200
ControlGet bEnabled, Enabled, , TJvImgBtn6, ahk_class TMainDlg
If bEnabled
Break
}
send {F5}
winwaitclose
sleep 2000
run "...next step...."
It only took a year, but patience seems to be rewarded
