LarsBNygaard Posted February 15, 2012 Share Posted February 15, 2012 I'm trying to start "picasa" at 1800 hours local time, but I get "$ID=(_NowTime) Start-picasa-kl1800.au3$ID=(_NowTime^ ERROR Error: Missing seperator character after keyword" The code I attempt is looking like this <code>-------------------------------------------------------------------------------------- #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <Date.au3> _NowTime([$sType = 4]) $ID =(_NowTime) If $ID =="18:00" Then run("C:\Program Files\Google\Picasa3\Picasa3.exe") Else Sleep(60000) EndIf Run("Start-picasa-kl1800.exe") </code>-------------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 15, 2012 Moderators Share Posted February 15, 2012 (edited) Hi, LarsBNygaard. To begin with, your _NowTime statement should be like this: $var = _NowTime(4) I don't have picassa, but something like this should nudge you in the right direction: #include <Date.au3> $var = _NowTime(4) If $var ="17:04" Then MsgBox(0, "", "Success!") Else Sleep(60000) EndIf Edited February 15, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
LarsBNygaard Posted February 16, 2012 Author Share Posted February 16, 2012 Hi JLogan3o13 Thankyou a zillion, I ended up with this - which seem to be working (haven't passed 1800 hours yet today)...; Script Start#include <Date.au3>$var = _NowTime(4)If $var ="18:00" Then run("C:Program FilesGooglePicasa3Picasa3.exe")EndIfSleep(60000)$PID = ProcessExists("Picasa3.exe")If $PID Then ProcessClose("Start-picasa-kl1800.exe")Else Run("D:Start-picasa-kl1800.exe")EndIf Link to comment Share on other sites More sharing options...
LarsBNygaard Posted February 16, 2012 Author Share Posted February 16, 2012 And now I got thinking... Would it be possible, to get the 'time' as a number, instead of as a $tring value? The reason for asking this is, that I'd like to lengthen the 'Sleep' i.e. to app. 10 minutes, but in order to make sure, that the script will start Picasa (when the clock pass 18:00), I guess I'll have to be able to make a comparison, between "desired time for start" and "real time"; in a manner somewhat like this: IF realtime > 18:00 THEN start program AND terminate script ELSE wait for [some-time] AND start all over again... If I start the script at EXACTLY 10:00, the sleep for 10 minutes, WILL (later this day) get the time, to be EXACTLY 18:00 - but if the script is initiated at i.e. 10:03, I'll not get the time to be exactly 18:00... Link to comment Share on other sites More sharing options...
JohnQSmith Posted February 16, 2012 Share Posted February 16, 2012 Would it be possible, to get the 'time' as a number, instead of as a $tring value?Take a look at the _TimeToTicks and _TicksToTime functions in the Help File. Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now