Jump to content

Recommended Posts

Posted

Hi, I have a script that runs internet explorer and uses the same URL with a slightly different address. For example:

Func PageSwitcher

$x = 0

If $x = 0 Then
 Run ("C:\Program Files\Internet Explorer\iexplore http://www.webpage.com/number1", "")
 $x = $x + 1
 Exitloop
Endif

If $x = 1 Then
 Run ("C:\Program Files\Internet Explorer\iexplore http://www.webpage.com/number2", "")
 $x = $x + 1
 Exitloop
EndIf

If $x = 2 Then
 Run ("C:\Program Files\Internet Explorer\iexplore http://www.webpage.com/number3", "")
 $x = $x - 2   ; now $x equals 0 and repeats the loop
 Exitloop
EndIf

EndFunc

Now, is there a more efficient way to do this? The way I have come up with works, but I have to have practically the same thing copied about 40 times with only a slight change in the link. I was thinking perhaps there was a way to take the "numberX" part out and replace it with a variable that had all of the number 1s, 2s, etc defined in it, and it would just grab them in order when called up. Any help- especially an example script- would be much appreciated, thanks :P

Posted (edited)

Func PageSwitcher()
    Dim $x
    For $i = 1 To 10
        Run (@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.webpage.com/number" & $i, @ProgramFilesDir & "\Internet Explorer")
        $x = $x + 1
    Next
;Sleep(500); I comment this out but you may need it
EndFunc

Edited by erebus

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
×
×
  • Create New...