Sign in to follow this  
Followers 0
LarsBNygaard

What am I missing..?

5 posts in this topic

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>--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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")

EndIf

Sleep(60000)

$PID = ProcessExists("Picasa3.exe")

If $PID Then

ProcessClose("Start-picasa-kl1800.exe")

Else

Run("D:Start-picasa-kl1800.exe")

EndIf

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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".

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0