Sign in to follow this  
Followers 0
Sardith

Question

19 posts in this topic

The question has to do with delays I suppose. Is there anyway to have a script cycle, off the windows clock?

So if it's 11am it will run the already running script in the background?


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites



Like.. if _NowTime(4) = "11:00" then do something?

Share this post


Link to post
Share on other sites

trying to make some more sense of what id like.... The script is already running, it's like a delay.. it reads windows clock' and at 11am it stops the delay and runs the rest of the script.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

So more like..

While 1
    Sleep (100)
    If _NowTime(4) = "11:00" Then ExitLoop
WEnd

Share this post


Link to post
Share on other sites

Interesting I'll give that a try thanks alot.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

What do you mean by _nowtime(4)

What does the the 4 indicate? Could I have, above my script..

nowtime(1) = "10:00pm"

nowtime(2) = "1:00pm"

?


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

The 4 option designates the return value. It is on a 24-hour clock, which means you don't need AM or PM, and it only returns hours and minutes.

Check the helpfile.

Share this post


Link to post
Share on other sites

Example

#include <Date.au3>
msgbox(0,"Time",_Nowtime(4))

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

If _NowTime(4) = "11:00" Then kill()
Endif

Func kill()
If WinExists("Darkages") Then
WinKill("Darkages");Gets rid of the running DA
Else

sleep(1200);Time delay for launch
Mouseclick("left", 170, 749, 1); For Launching
Sleep(2000)
logon()
Endif
EndFunc


;logon()
;Endif


Func logon()
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
sleep(2000)
Mouseclick("left", 236, 419, 1)
sleep(700)
Mouseclick("left", 109, 347, 1)
sleep(1000)
$hWnd = WinGetHandle("Darkages");Name of the programs' title
_Sendkeys($hWnd, "+Nicad");Name
sleep(2000)
_Sendkeys($hWnd, "{TAB}")
sleep(500)
_Sendkeys($hWnd, "******");Password
sleep(500)
_Sendkeys($hWnd, "{ENTER}")
EndFunc

Not sure where im going wrong..

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

you didnt add in a loop to keep checking

quick question, what UDF has _sendkeys?

why not just use send()

hile 1
If _NowTime(4) = "11:00" Then 
    kill()
WEnd
Func kill()
If WinExists("Darkages") Then
WinKill("Darkages");Gets rid of the running DA
Else
sleep(1200);Time delay for launch
Mouseclick("left", 170, 749, 1); For Launching
Sleep(2000)
logon()
Endif
EndFunc


;logon()
;Endif


Func logon()
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
sleep(2000)
Mouseclick("left", 236, 419, 1)
sleep(700)
Mouseclick("left", 109, 347, 1)
sleep(1000)
$hWnd = WinGetHandle("Darkages");Name of the programs' title
_Sendkeys($hWnd, "+Nicad");Name
sleep(2000)
_Sendkeys($hWnd, "{TAB}")
sleep(500)
_Sendkeys($hWnd, "******");Password
sleep(500)
_Sendkeys($hWnd, "{ENTER}")
EndFunc
Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

#11 ·  Posted

This may sound stupid but what 10pm?

If _NowTime(4) = "11:00" Then kill()


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

10 pm would be

22:00

my bad :think: subtracted 4 instead of jsut 2

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

#13 ·  Posted

Christ me and my questions. How would I go about having it run the script at more then one time? Like 22:00 and 9am?


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

simpyl use the word or :think:

while 1
If _NowTime(4) = "22:00" or _NowTime(4) = "9:00" Then 
    kill()
WEnd
Func kill()
If WinExists("Darkages") Then
WinKill("Darkages");Gets rid of the running DA
Else
sleep(1200);Time delay for launch
Mouseclick("left", 170, 749, 1); For Launching
Sleep(2000)
logon()
Endif
EndFunc


;logon()
;Endif


Func logon()
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
sleep(2000)
Mouseclick("left", 236, 419, 1)
sleep(700)
Mouseclick("left", 109, 347, 1)
sleep(1000)
$hWnd = WinGetHandle("Darkages");Name of the programs' title
_Sendkeys($hWnd, "+Nicad");Name
sleep(2000)
_Sendkeys($hWnd, "{TAB}")
sleep(500)
_Sendkeys($hWnd, "******");Password
sleep(500)
_Sendkeys($hWnd, "{ENTER}")
EndFunc
Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

#15 ·  Posted

Excellent, one more problem. Befor I get to that id like to thank everyone for helping me thus far.

It keeps running the program, since it's still 22:00. How could I get it to only do it once..?


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

#16 ·  Posted

#include <date.au3>
while 1
If _NowTime(4) = "22:00" or _NowTime(4) = "19:02" Then 
    kill()
EndIf
WEnd
Func kill()
    msgbox(0,"asfd","its time")
If WinExists("Darkages") Then
WinKill("Darkages");Gets rid of the running DA
Exit
Else
sleep(1200);Time delay for launch
Mouseclick("left", 170, 749, 1); For Launching
Sleep(2000)
logon()
Endif
EndFunc


;logon()
;Endif


Func logon()
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
Mouseclick("left", 166, 231, 1)
sleep(2000)
Mouseclick("left", 236, 419, 1)
sleep(700)
Mouseclick("left", 109, 347, 1)
sleep(1000)
$hWnd = WinGetHandle("Darkages");Name of the programs' title
_Sendkeys($hWnd, "+Nicad");Name
sleep(2000)
_Sendkeys($hWnd, "{TAB}")
sleep(500)
_Sendkeys($hWnd, "******");Password
sleep(500)
_Sendkeys($hWnd, "{ENTER}")
Exit
EndFunc

just add an exit after them so when it does run itll exit

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Would making it 13:30:00 do the trick? That didn't work :/ Exit works, but I can't have it exit, I still need the script running.

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

#18 ·  Posted

Just put this wherever it belongs.

Global $HasRun = 0

If (_NowTime(4) = "22:00" or _NowTime(4) = "09:00") And $HasRun = 0 Then
    kill()
    $HasRun = 1
EndIf

If _NowTime(4) <> "22:00" And _NowTime(4) <> "09:00" And $HasRun = 1 Then $HasRun = 0

Share this post


Link to post
Share on other sites

#19 ·  Posted

eh thats to hard seriously lol id prefer just making it exit once its done same some PC usage :think:

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