Sardith Posted May 1, 2006 Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
greenmachine Posted May 1, 2006 Share Posted May 1, 2006 Like.. if _NowTime(4) = "11:00" then do something? Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
greenmachine Posted May 1, 2006 Share Posted May 1, 2006 So more like.. While 1 Sleep (100) If _NowTime(4) = "11:00" Then ExitLoop WEnd Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
greenmachine Posted May 1, 2006 Share Posted May 1, 2006 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. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 1, 2006 Share Posted May 1, 2006 Example #include <Date.au3> msgbox(0,"Time",_Nowtime(4)) Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 (edited) expandcollapse popupIf _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 May 1, 2006 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] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 1, 2006 Share Posted May 1, 2006 (edited) you didnt add in a loop to keep checking quick question, what UDF has _sendkeys? why not just use send() expandcollapse popuphile 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 May 1, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 1, 2006 Share Posted May 1, 2006 (edited) 10 pm would be 22:00 my bad subtracted 4 instead of jsut 2 Edited May 1, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 1, 2006 Share Posted May 1, 2006 (edited) simpyl use the word or expandcollapse popupwhile 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 May 1, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 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] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 1, 2006 Share Posted May 1, 2006 expandcollapse popup#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 Link to comment Share on other sites More sharing options...
Sardith Posted May 1, 2006 Author Share Posted May 1, 2006 (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 May 1, 2006 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] Link to comment Share on other sites More sharing options...
greenmachine Posted May 1, 2006 Share Posted May 1, 2006 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 Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 1, 2006 Share Posted May 1, 2006 eh thats to hard seriously lol id prefer just making it exit once its done same some PC usage 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