Jump to content
Sign in to follow this  

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!")



; 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


; Wait for the Browser become active

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

; Now that the Main Browser window is active





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

Func MyExit()



; 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

Share this post

Link to post
Share on other sites


$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 !")

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

Cheers, FireFox.


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control


Share this post

Link to post
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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.