Jump to content

Need Help With Looping a Variable?


Recommended Posts

I'm new to Autoit but I really do like it, so I'm starting off creating basic scripts that in my opinion are useful :)

Here is my code so far :

; Hotkeys for the script

HotKeySet("^!x", "MyExit")

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)

$answer = MsgBox(4, "Refresh Page 1.1 (English Only)", "Would You Like To Run 'Refresh Page 1.1'?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

; If "No" was clicked (7) then exit the script

If $answer = 7 Then

MsgBox(0, "AutoIt", "Later!")

Exit

EndIf

; Lets find out how many times we should refresh the page

$amount = InputBox("Refresh Page 1.1 English Only)", "How Many Times Should We Refresh Your Page?")

; Lets find out the link of the page you want refreshed

$link= InputBox("Refresh Page 1.1 (English Only)", "What's The Full URL of The Page You Want Refreshed?")

; Run Main Browser

Send("{BROWSER_HOME}")

; Wait for the Browser become active

WinWaitActive("[CLASS:MozillaUIWindowClass]", "")

; Now that the Main Browser window is active

Send("{BACKSPACE}")

Send("{ALTDOWN}d{ALTUP}")

Send($link)

Send("{ENTER}")

; Now that your on the page that you want refreshed, let's refresh it

Func MyExit()

Exit

EndFunc

; Finished!

So what I'm trying to do is the variable $amount I'm trying to make it so it refreshes the page you go to that amount of times which I believe is a loop. CTRL + R to reload the browser page. I don't know where to begin :o
Link to comment
Share on other sites

@TheScripter

$msgbox = MsgBox(2, "title", "click on one of two buttons")

If $msgbox = 1 Then
Msgbox(64, "reponse", "button OK pressed !")
ElseIf $msgbox = 2 Then
Msgbox(64, "reponse", "button Cancel pressed !")
EndIf

Can you use code tags instead of using quote tags because with my ipod i cant edit your script.

Cheers, FireFox.

Link to comment
Share on other sites

After this line in your code:

; Now that your on the page that you want refreshed, let's refresh it

Insert this code:

For $iLoop = 1 to $amount
      Sleep(10000); Wait 10 seconds, increase this if necessary
      Send("^R"); CTRL + R = Reload
Next; $amount
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...