Jump to content

Unlocator IP update script


Automania
 Share

Recommended Posts

Hello,

I created a script that automatically updates one's own IP for the unlocator.com service (tested with IE 10 and 11 on Win7 64bit):

#include <IE.au3>
Opt('MustDeclareVars', 1)
Global $oIE, $sURL, $tForm, $FormElem, $oSubmit, $oForm

$sURL = 'https://www.unlocator.com/account/login'
$oIE = _IECreate($sURL) ;open IE window and browse given website
$tForm = _IEFormGetObjByName($oIE, 'login')
$FormElem = _IEFormElementGetObjByName($tForm, 'amember_login')
_IEFormElementSetValue($FormElem, 'email@domain.com') ;fill in user name in respective form field
$tForm = _IEFormGetObjByName($oIE, 'login')
$FormElem = _IEFormElementGetObjByName($tForm, 'amember_pass')
_IEFormElementSetValue($FormElem, '12345') ;fill in password in respective form field
_IEFormSubmit($tForm, 0)    ;send form to complete website login
_IELoadWait($oIE)

$oForm = _IEFormGetCollection($oIE, 0)
_IEFormSubmit($oForm) ;press "Update IP" button
sleep(3000)    ;optional
_IEQuit($oIE)    ;close browser instance

Of course, don't forget to replace email@domain.com with your registered email address and 12345 with your actual password. ;)

Note:

it ran fine on my work PC but not at home (had an older autoit version there). So if it doesn't work, try the latest Autoit version.

Edited by Automania
Link to comment
Share on other sites

In case you'd like to pass on the compiled script or don't want to hardcode the login data for whatever reason you could also use command line parameters instead (plus a shortcut):

#include <IE.au3>
Opt('MustDeclareVars', 1)
Global $oIE, $sURL, $tForm, $FormElem, $oSubmit, $oForm, $username, $password

if $CmdLine[0] = 2 Then    ;if script was launched with 2 command line parameters
   $username = $CmdLine[1]
   $password = $CmdLine[2]
Else
   MsgBox(16, "Unlocator Script", "Please launch with command line parameters for your username and password." & @CR & "For example:" & @CR & "unlocator.exe email@domain.com password123")
   exit
EndIf


$sURL = 'https://www.unlocator.com/account/login'
$oIE = _IECreate($sURL) ;open IE window and browse given website
$tForm = _IEFormGetObjByName($oIE, 'login')
$FormElem = _IEFormElementGetObjByName($tForm, 'amember_login')
_IEFormElementSetValue($FormElem, $username)    ;fill in user name in respective form field
$tForm = _IEFormGetObjByName($oIE, 'login')
$FormElem = _IEFormElementGetObjByName($tForm, 'amember_pass')
_IEFormElementSetValue($FormElem, $password)  ;fill in password in respective form field

_IEFormSubmit($tForm, 0)    ;send form to complete website login
_IELoadWait($oIE)

$oForm = _IEFormGetCollection($oIE, 0)
_IEFormSubmit($oForm)    ;press "Update IP" button
sleep(3000) ;optional
_IEQuit($oIE)   ;close browser instance
Edited by Automania
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...