bb05 Posted October 19, 2007 Share Posted October 19, 2007 (edited) Hey everyone, back again with a little bit of an idea. want to download 1 file over and over every 2 minutes, then pause for an hour, and repeat. I was taking a look at this topic and saw this code:#include <IE.au3> #include <String.au3> FileOpen ("links.txt", 0) $LINE = FileReadLine ("link.txt", 1) $Ventana = _IECreate ($LINE) $Free = _IEGetObjByName ($Ventana, "dl.start", 1) _IEAction ($Free, "click") _IELoadWait ($Ventana) $Img = _IEImgGetCollection($Ventana, 2) $ImgLink = $Img.src InetGet($ImgLink, @HomeDrive & "\" & "OCR.jpg") FileInstall("gocr.exe", @HomeDrive & "\gocr.exe") FileInstall("djpeg.exe", @HomeDrive & "\djpeg.exe") RunWait(@ComSpec & " /c " & @HomeDrive & '\djpeg.exe' & " " & @HomeDrive & '\OCR.jpg' & " " & @HomeDrive & '\OCR.pnm' , "", @SW_HIDE) RunWait(@ComSpec & " /c " & @HomeDrive & '\gocr.exe' & " -o " & @HomeDrive & '\OCR.txt ' & @HomeDrive & "\OCR.pnm" , "", @SW_HIDE) FileDelete(@HomeDrive & "\OCR.jpg") FileDelete(@HomeDrive & "\OCR.pnm") FileDelete(@HomeDrive & "\djpeg.exe") FileDelete(@HomeDrive & "\gocr.exe") FileOpen(@HomeDrive & "\OCR.txt", 0) $OCRtext = FileReadLine (@HomeDrive & "\OCR.txt", 1) $InputTextBox = _IEGetObjByName ($Ventana, "accesscode") _IEFormElementSetValue ($InputTextBox, $OCRtext) $DownloadButton = _IEGetObjByName ($Ventana, "actionstring") _IEAction($DownloadButton, "click")Now i believe that it would be possible to set variables in order to see how many times the program has gone through.So like -Loop 1 for 60 minute timer -- Loop 2 for 2 minute timer --- code -- Test Loop 2-Test Loop 1Any help would be greatly appreciated. Just for reference, I do need to use While and Wend correct or would there be a better solution? Edited October 19, 2007 by bb05 Link to comment Share on other sites More sharing options...
Nahuel Posted October 19, 2007 Share Posted October 19, 2007 Yeah, you'd need a loop. But you can also do it with AdlibEnable(). Look in the help file for TimerInit() and TimerDiff(). You'll be able to come up with something Link to comment Share on other sites More sharing options...
bb05 Posted October 20, 2007 Author Share Posted October 20, 2007 ok, so here's my updated code. not really sure how i would go any further with it, or if its even correct, but here it is: expandcollapse popupAdlibEnable("Loop1") Func(2minloop) $begin = TimerInit() Sleep(160000) $dif = TimerDiff() Func(hourloop) $begin = TimerInit() Sleep(3600000) $dif = TimerDiff() #include <IE.au3> #include <String.au3> FileOpen ("links.txt", 0) $LINE = FileReadLine ("link.txt", 1) $Ventana = _IECreate ($LINE) $Free = _IEGetObjByName ($Ventana, "dl.start", 1) _IEAction ($Free, "click") _IELoadWait ($Ventana) $Img = _IEImgGetCollection($Ventana, 2) $ImgLink = $Img.src InetGet($ImgLink, @HomeDrive & "\" & "OCR.jpg") FileInstall("gocr.exe", @HomeDrive & "\gocr.exe") FileInstall("djpeg.exe", @HomeDrive & "\djpeg.exe") RunWait(@ComSpec & " /c " & @HomeDrive & '\djpeg.exe' & " " & @HomeDrive & '\OCR.jpg' & " " & @HomeDrive & '\OCR.pnm' , "", @SW_HIDE) RunWait(@ComSpec & " /c " & @HomeDrive & '\gocr.exe' & " -o " & @HomeDrive & '\OCR.txt ' & @HomeDrive & "\OCR.pnm" , "", @SW_HIDE) FileDelete(@HomeDrive & "\OCR.jpg") FileDelete(@HomeDrive & "\OCR.pnm") FileDelete(@HomeDrive & "\djpeg.exe") FileDelete(@HomeDrive & "\gocr.exe") FileOpen(@HomeDrive & "\OCR.txt", 0) $OCRtext = FileReadLine (@HomeDrive & "\OCR.txt", 1) $InputTextBox = _IEGetObjByName ($Ventana, "accesscode") _IEFormElementSetValue ($InputTextBox, $OCRtext) $DownloadButton = _IEGetObjByName ($Ventana, "actionstring") _IEAction($DownloadButton, "click") EndFunc EndFunc Link to comment Share on other sites More sharing options...
Nahuel Posted October 20, 2007 Share Posted October 20, 2007 Mmm... that doesn't do anything Did you read the helpfile for TimerInit() and TimerDiff()??? This is more like what I had in mind: #include <IE.au3> #include <String.au3> Global $Diff=0 While 1 $Diff=0 $Time=TimerInit() While $Diff < 2000 $Diff=TimerDiff($Time) Sleep(100) WEnd MsgBox(0,"","Ok, now we are downloading") WEnd Link to comment Share on other sites More sharing options...
bb05 Posted October 20, 2007 Author Share Posted October 20, 2007 i did read the help files on timediff() but they didnt have the greatest examples so i wasnt completely sure of how-to use the codes, hence the post here. one of the things that is really confusing me is how i will be able to have to while statements running inside of each other and then testing to see which while statement is suppose to be running (eg: not have the 2 minute timer run when the hour timer is suppose to run and vise versa.) Link to comment Share on other sites More sharing options...
ericg32 Posted October 21, 2007 Share Posted October 21, 2007 If you want to get really simple.. Write a script that downloads the file.. waits 2 minutes.. downloads it again.. THEN schdules itself to run at the appoited time.. SUppose you want it to run at 12 past the hour.. jsut get the currnt hour.. +1/ fix it up for 23 -> then add an entry into the windwos scheduler Link to comment Share on other sites More sharing options...
bb05 Posted October 23, 2007 Author Share Posted October 23, 2007 ok i attempted to accomplish what you said but i am not having any luck getting this to work. i am still a little new to auto-it. not requesting for someone to do this for me.. but if they want to.. i wouldnt complain either, lol. 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