Jump to content

Counting


Recommended Posts

Hi, I need help with adding this part to my script to show how many times it has looped. Like, in a txt file or something have it save how many times it looped. Heres my script incase you want to see it.

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

HotKeySet("{ESC}" , "end" )

Func end()
    Exit
EndFunc

While 1
$var = "http://www.xanga.com/Rachels_4Ever/446601178/item.html"
run("C:\Program Files\Mozilla Firefox\firefox.exe " & $var)
WinWaitActive("Rachels_4Ever's")
WinActivate("Rachels_4Ever's", "")
MouseClick ("left", 1269, 959 , 5 , 5)
MouseClick ("left", 685, 951 ,1 , 5)
WinWaitActive("Rachels_4Ever's Xanga Site - 2/20/2006 9:57:41 PM")
send ("{END}")
mouseclick ("left", 410, 599 , 1 , 5 )
send ("I Bet I Can Leave More Comments{!}")
sleep("1000")
MouseClick ("left", 230, 832, 1, 5)
sleep("30000")
WinWait ("Rachels_4Ever's Xanga Site - 2/20/2006 9:57:41 PM")
WinKill("Rachels_4Ever's Xanga Site - 2/20/2006 9:57:41 PM", "")
WEnd
Edited by Sparrowlord
Link to comment
Share on other sites

I like using TrayTips (assuming you're there to watch the tips being shown) - the code would be simple to add as well.

Before the While loop, add $LoopCount = 0. Then, at the end of the While loop, add $LoopCount += 1 (assuming you have beta), and TrayTip ("Loop Count", $LoopCount & " loops done.", 1).

$LoopCount = 0
While 1
; your code
$LoopCount += 1
TrayTip ("Loop Count", $LoopCount & " loops done.", 1)
WEnd
Link to comment
Share on other sites

I GOT IT!

With some help from:

http://www.autoitscript.com/forum/index.php?showtopic=22141

I came up with this:

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

HotKeySet("{ESC}" , "end" )

Func end()
    Exit
EndFunc

$LoopCount = 0
While 1
$var = "http://www.xanga.com/Rachels_4Ever/446601178/item.html"
run("C:\Program Files\Mozilla Firefox\firefox.exe " & $var)
WinWaitActive("Rachels_4Ever's")
WinActivate("Rachels_4Ever's", "")
MouseClick ("left", 1269, 959 , 5 , 5)
MouseClick ("left", 685, 951 ,1 , 5)
WinWaitActive("Rachels_4Ever's Xanga Site - 2/20/2006 9:57:41 PM")
send ("{END}")
mouseclick ("left", 410, 599 , 1 , 5 )
send ("I Bet I Can Leave More Comments{!}")
sleep("1000")
MouseClick ("left", 230, 832, 1, 5)
sleep("30000")
WinWait ("Rachels_4Ever's Xanga Site - 2/20/2006 9:57:41 PM")
WinKill("Rachels_4Ever's Xanga Site - 2/20/2006 9:57:41 PM", "")
$LoopCount += 1
$OpenFile = FileOpen ("YourFile.txt", 2)
FileWriteLine($OpenFile, $LoopCount & " loops done.")
FileClose ($OpenFile)
WEnd
Link to comment
Share on other sites

Ok, you used my other method - that's cool too. One thing though - you don't need to fileopen and fileclose everytime during the loop. Simply put the fileopen at the top (before the loop) to make it more efficient. Then.. in your exit function, put the fileclose statement (before the exit).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...