start up .exe in X minutes?
#1
Posted 27 October 2005 - 07:09 PM
I need a simple tool/script to let me start up a certain .exe file in a definable number of minutes. It would be perfect if a tiny window (InputBox) would pop up when I start this tool/script, where I would just have to enter the minute value (if I like a different one from the one before) and hit Enter. Then maybe there would be a countdown displayed where I can change the minute value to restart the countdown with that and maybe a stop button to stop the countdown completely.
Any ideas? Any pointers? Should be possible with AutoHotkey, right?
#2
Posted 27 October 2005 - 07:42 PM
#Persistent InputBox, Laufzeit, enter Time to start program in seconds Laufzeit := Laufzeit * 1000 Laufzeit := Floor(Laufzeit) Zeit = %A_TickCount% Settimer, Start_Program, %Laufzeit% Settimer, Anzeiger, 500 ;msgbox, % laufzeit return Anzeiger: till_start := (laufzeit - A_TickCount + zeit)/1000 till_start := Floor(till_start) tooltip, %till_start% Seconds return start_Program: ;run, Your_program.exe ;enter here your program and remove ";" settimer, anzeiger, off tooltip, Program started sleep, 4000 tooltip ExitApp return
#3
Posted 28 October 2005 - 09:08 AM
Thanks a lot, could you help me please to further improve it?Hope this example will help you, to get your skript, adjust it to your needs
My problems now are:
I had to remove ExitApp because I use this script as part of my main AHK script that is running 24/7 - how do I tell the script to stop and not start the .exe *every* x seconds?I changed the info from tooltip to traytip - but how do I disable that after the .exe is started? I tried several things, nothing worked
;Start .exe file in x seconds
;http://www.autohotkey.com/forum/viewtopic.php?p=36314#36314
^q::
#Persistent
InputBox, Laufzeit, enter Time to start program in seconds
Laufzeit := Laufzeit * 1000
Laufzeit := Floor(Laufzeit)
Zeit = %A_TickCount%
Settimer, Start_Program, %Laufzeit%
Settimer, Anzeiger, 500
return
Anzeiger:
till_start := (laufzeit - A_TickCount + zeit)/1000
till_start := Floor(till_start)
TrayTip, , .exe count-down
SetTimer, RemoveTrayTip4Exe, %Laufzeit%
return
RemoveTrayTip4Exe:
SetTimer, RemoveTrayTip4Exe, Off
TrayTip
return
start_Program:
run, C:\Programme\Skype\Phone\Skype.exe
settimer, anzeiger, off
SetTimer, RemoveTrayTip4Exe, Off
return
;Start .exe file in x seconds
#4
Posted 28 October 2005 - 09:42 AM
Anzeiger: till_start := (laufzeit - A_TickCount + zeit)/1000 till_start := Floor(till_start) TrayTip, , .exe count-down %till_start% return start_Program: settimer, Anzeiger, off TrayTip run, C:\Programme\Skype\Phone\Skype.exe return
#5
Posted 28 October 2005 - 10:19 AM
the script still loops, how do I stop the countdown when the .exe is started?the time until the .exe is started is displayed in the tray, but the updates are strange: I tried it with 15 seconds first and it *slowly* counted down "14, 13, 12" - and then already started the .exe (15 seconds HAD passed already)I then changed the code to minutes instead of seconds (and added a 5 seconds delay (see below) so the start value would be shown correctly). I tried it with 4 minutes and now I saw "4, 3, 2" - and then the .exe was started... no idea why... :?
;Start .exe file in x seconds ;http://www.autohotkey.com/forum/viewtopic.php?p=36314#36314 ^q:: #Persistent InputBox, Laufzeit, enter Time to start program in minutes Laufzeit := Laufzeit * 60000 + 5000 Laufzeit := Floor(Laufzeit) Zeit = %A_TickCount% Settimer, Start_Program, %Laufzeit% Settimer, Anzeiger, 3000 return Anzeiger: till_start := (laufzeit - A_TickCount + zeit)/60000 till_start := Floor(till_start) TrayTip, , .exe count-down %till_start% return start_Program: settimer, Anzeiger, off TrayTip run, C:\Programme\Skype\Phone\Skype.exe return ;Start .exe file in x seconds
#6
Posted 28 October 2005 - 10:27 AM
#Persistent ^q:: InputBox, Laufzeit, enter Time to start program in minutes Laufzeit := Laufzeit * 60000 + 5000 Zeit = %A_TickCount% SetTimer, Start_Program, %Laufzeit% SetTimer, Anzeiger, 3000 GoSub, Anzeiger return Anzeiger: till_start := (Laufzeit - A_TickCount + zeit)/60000 TrayTip, , .exe count-down`n minutes to start %till_start% return start_Program: SetTimer, Start_Program, Off SetTimer, Anzeiger, off TrayTip run, C:\Programme\Skype\Phone\Skype.exe return
#7
Posted 28 October 2005 - 10:42 AM
to end the skript, you have to terminate the start-timer, too.
Seconds are displayed now, too.
^q:: #Persistent InputBox, Laufzeit, enter Time to start program in minutes Laufzeit := Laufzeit * 60000 Zeit = %A_TickCount% Settimer, Start_Program, %Laufzeit% Settimer, Anzeiger, 100 return Anzeiger: till_start_minutes := (laufzeit - A_TickCount + zeit)/60000 till_start_minutes := Floor(till_start_minutes) till_start_seconds := (laufzeit - A_TickCount + zeit)/1000 - (till_start_minutes * 60) till_start_seconds := Floor(till_start_seconds) TrayTip, , .exe count-down %till_start_minutes%:%till_start_seconds% return start_Program: settimer, Anzeiger, off TrayTip ; run, C:\Programme\Skype\Phone\Skype.exe settimer, Start_Program, off msgbox, start return
uups, should reload windows before posting, hihi, toralf was faster
#8
Posted 28 October 2005 - 11:03 AM
toralfs' version is able to count-down correctly here, but the time format is a bit strange:

garath's version displays the time in a nice format, but still isn't counting down in real-time:
#9
Posted 28 October 2005 - 11:16 AM
Tested it.
Can you tell me, what part is not working
exactly?The old version from you was incorrect because of wrong rounding of minutes and update Taskbar only each 3 seconds
#10
Posted 28 October 2005 - 01:24 PM
Strange... I made some screenshots (while only using your script), see below. While toralf's script was counting down just fine your script just shows the correct time just AFTER a screenshot is made! :shock:hmm, my version is working well, and counts real-time.
Tested it.
Can you tell me, what part is not workingexactly?
The old version from you was incorrect because of wrong rounding of minutes and update Taskbar only each 3 seconds
Just compare the Windows time shown at the top with the remaining time the script shows - and please note the strange "1:6" times that I highlighted with yellow:
#11
Posted 28 October 2005 - 02:38 PM

Are you sure, that you didn`t use parts of toralf`s script?
I use Windows XP prof. with Autohotkey1.0.40.00
is the maximum difference to real Time 3 seconds?

Maybe, you got an old version of my script, changed it a bit, especially this part:
Settimer, Anzeiger, 100which affects the actualisation intervall.
I have no clue, what could be wrong.
#12
Posted 28 October 2005 - 03:26 PM
Let us both update to AutoHotkey 1.0.40.03 and see what happens.
[...]
Ok, updated - nothing changed, still not counting correctly here :?
And yes, "Settimer, Anzeiger, 100" is in there.
#13
Posted 28 October 2005 - 03:30 PM
#14
Posted 28 October 2005 - 03:32 PM
Please copy your script back into the forum
Changed the Code a bit, to get rid of this bug, could you check, if this script isn`t working the right way, too?
It will count up seconds and minutes after pressing Ctrl + q
^q:: #Persistent Zeit = %A_TickCount% Settimer, Anzeiger, 100 return Anzeiger: till_start_minutes := (A_TickCount - zeit)/60000 till_start_minutes := Floor(till_start_minutes) till_start_seconds := ( A_TickCount - zeit)/1000 - (till_start_minutes * 60) till_start_seconds := Floor(till_start_seconds) TrayTip, , Count up %till_start_minutes%:%till_start_seconds% return
#15
Posted 28 October 2005 - 04:01 PM
Ok, I removed the other script and just run this short script: it does only count "0:1", a minute later "0:2", and so on... seconds aren't really working...Lol, updated, still work like a charm, maybe, we found a Win2000 bug?
Please copy your script back into the forum
Changed the Code a bit, to get rid of this bug, could you check, if this script isn`t working the right way, too?
It will count up seconds and minutes after pressing Ctrl + q
Here's the other trouble-some script again:
^q:: #Persistent InputBox, Laufzeit, enter Time to start program in minutes Laufzeit := Laufzeit * 60000 Zeit = %A_TickCount% Settimer, Start_Program, %Laufzeit% Settimer, Anzeiger, 100 return Anzeiger: till_start_minutes := (laufzeit - A_TickCount + zeit)/60000 till_start_minutes := Floor(till_start_minutes) till_start_seconds := (laufzeit - A_TickCount + zeit)/1000 - (till_start_minutes * 60) till_start_seconds := Floor(till_start_seconds) TrayTip, , .exe count-down %till_start_minutes%:%till_start_seconds% return start_Program: settimer, Anzeiger, off TrayTip run, C:\Programme\Skype\Phone\Skype.exe settimer, Start_Program, off ;msgbox, start return




