Jump to content

Recommended Posts

Posted

I need help with using variables and else if, I have the script running firefox with my router status set as homepage so it can change my ip for me ( for d2 realm downs), But it does't allways start with the same screen 1/2 the time it starts with a window named Prompt and the other Half it starts with a window named Setup, i just need to know how to set it up so that if prompt comes up it will wun login and if it doesn't then it will go stright to focus2. here is the code (my very first so go easy on me)

;Ricky's lil ip reset script
FireFox()
Focus()
Login()
Focus2()
Disconnect()
Connect()
Close()

Func FireFox()
    Run(""C:\Program Files\Mozilla Firefox\firefox.exe"", "", @SW_MAXIMIZE)
EndFunc
;---------------------------------------------------------------------------------------------------------
;If prompt comes up
Func Focus()
    WinActivate("Prompt ", "")
EndFunc

Func Login()
    MouseClick("left", 195, 186, 1)
EndFunc
;---------------------------------------------------------------------------------------------------------
;If/Once setup comes up
Func Focus2()
    WinActivate("Setup ", "")
EndFunc

Func Disconnect()
    MouseClick("left", 488, 428, 1)
    Sleep(5000)
EndFunc

Func Connect()
    MouseClick("left", 488, 428, 1)
    Sleep(10000)
EndFunc

Func Close()
    WinKill("Setup", "")
EndFunc
Posted

Ok so which window name can you use and which cant you use ?

So far it looks like if the window named SETUP pops up then you CAN change your ip.

IF Prompt pops up then you CANT ?

is that correct.

What happens if the wrong window pops up ? do you want your script to close the window and try to open a new one ?

Posted (edited)

Need the details I asked for above but until then I think this is the direction you are heading in

Sleep(1000)
  Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe"", "", @SW_MAXIMIZE)
  
  Sleep(2000)
  
  If WinExists("Promp") Then
      getjggywitit()
 EndIf

  If WinExists("Setup") Then
      MouseClick("left", 488, 428, 1)
    Sleep(5000)
    MouseClick("left", 488, 428, 1)
    Sleep(10000)
     WinKill("Setup")
EndIf



  Func getjggywitit()
      Sleep(500)
      MouseClick("left", 195, 186, 1)
      EndFunc
Edited by megahyperion
Posted (edited)

Ya if prompt pops up i need it to do login() but i see how to use If now ty so much

and wow u made the code look alot better tehn i had it lol ty

Edit: so eventually after some test runnin i came up with this which works every time:

;Ricky's lil ip reset script

Sleep(1000)
  Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe", "", @SW_MAXIMIZE)
  
  Sleep(10000)
  
  If WinExists( "Prompt") Then
      getjggywitit()
EndIf

    Sleep(5000)

  If WinExists( "Setup -") Then
      Doitbig()
EndIf

    Func getjggywitit()
      MouseClick("left", 445, 441, 1)
EndFunc

    Func Doitbig()
      MouseClick("left", 794, 63, 1)
      Sleep(5000)
      MouseClick("left", 481, 406, 1)
    Sleep(5000)
    MouseClick("left", 481, 406, 1)
    Sleep(10000)
     WinKill("Setup")
 EndFunc

I had to add MouseClick("left", 794, 63, 1) so it would refresh the page because soemtimes it doesn't want to load all the way

Edited by h-y-b-r-i-d
Posted

Cool glad its all working for you and gld I could help.

When your bored just browse through the help file, You will come across alot of functions and say "hey I can use that to do this or that" Kinda gets the gears moving.

Posted

Oh yeah side note, I never programmed a day in my life until about 3 months ago (thats gods honest truth)

Learned 80% of what I know from the help file 10% from these forums and 10% from experience/ trial and error.

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...