Sign in to follow this  
Followers 0
ParoXsitiC

Updating Internet Options

5 posts in this topic

This is a very sloppy script but I am trying to change proxies on the fly in IE. I need to be able to do somethign like this http://www.codeproject.com/internet/changeproxy1.asp more importantly I need to be able to call the Existing Internet Explorer instances are notified that the proxy was changed by INTERNET_OPTION_SETTINGS_CHANGED and INTERNET_OPTION_REFRESH as stated on that page.

I do not know how I can call those in AutoIT..therefore I made the updateProps() screen. which is very noob like. If someone could assist me in calling either calling INTERNET_OPTION_SETTINGS_CHANGED and INTERNET_OPTION_REFRESH or in automated the property button clicks without using tabs and winwaits.

#include <IE.au3>
#include <Inet.au3>

$Referer = "http://www.imvu.com/catalog/web_registration.php?userId=227598"
;$URL = "http://www.imvu.com/catalog/web_registration.php/action/tune/dna/80_14596_14594_14595_11267_12749_131_14563_14633_61995+1_1_1_1_1_1_1.jpg"
;$URL = "http://www.imvu.com/catalog/web_registration.php?userId=227598"
$User = "&userId=227598"
$Form = "&avatarname=aiuhdasiud&password=708050&confirmation=708050&tagline=whodsff&email_address=pa.r.o.xsitic@gmail.com&dob_month=07&dob_day=11&dob_year=1984&country=223_AL&survery=1&friend_email="
$Body = "&head_choice=61995&skintone_choice=11267&eyes_choice=12749&hair_choice=161&top_choice=12156&bottom_choice=14594&shoes_choice=14729&attachment_choice=12202"
$FormURL = "http://www.imvu.com/catalog/web_registration.php?action=process"
$BodyURL = "http://www.imvu.com/catalog/web_registration.php?action=register"


While 1


    TrayTip("Proxy started","Attempting to register account",100)
    $Begin = TimerInit()
    Dim $oWinmgmts = ObjGet("winmgmts:{impersonationLevel=impersonate}")
    Dim $Proxies = $oWinmgmts.InstancesOf("Win32_proxy")
    For $Proxy In $Proxies
        $Proxy.SetProxySetting ("localhost","8118" )
    Next
$o_IE = _IECreate ("about:blank",0,1)

    $URL = $BodyURL & $Body & $User
    $o_IE.navigate ($URL, 0, 0, 0, "Referer: " & $Referer)
    _IELoadWait ($o_IE)
    $o_Form = _IEFormGetObjByName ($o_IE, "web_registration")
    $o_avatarname = _IEFormElementGetObjByName ($o_Form, "avatarname")
    $o_password = _IEFormElementGetObjByName ($o_Form, "password")
    $o_confirmation = _IEFormElementGetObjByName ($o_Form, "confirmation")
    $o_tagline = _IEFormElementGetObjByName ($o_Form, "tagline")
    $o_email_address = _IEFormElementGetObjByName ($o_Form, "email_address")
    
    $o_dob_month = _IEFormElementGetObjByName ($o_Form, "dob_month") ;select
    $o_dob_day = _IEFormElementGetObjByName ($o_Form, "dob_day") ;select
    $o_dob_year = _IEFormElementGetObjByName ($o_Form, "dob_year") ;select
    $o_country = _IEFormElementGetObjByName ($o_Form, "country") ;select
    
    
    $randName = GenerateRandomName()
    
    
    _IEFormElementSetValue ($o_avatarname, $randName)
    _IEFormElementSetValue ($o_password, "default123")
    _IEFormElementSetValue ($o_confirmation, "default123")
    _IEFormElementSetValue ($o_tagline, "Heyyyy! I'll fill this out later :)")
    
    _IEFormElementSetValue ($o_email_address, "paroxsitic+" & $randName & "@gmail.com")
    _IEFormElementOptionselect ($o_dob_month, "June", 1, "byText")
    _IEFormElementOptionselect ($o_dob_day, "04", 1, "byText")
    _IEFormElementOptionselect ($o_dob_year, "1985", 1, "byText")
    _IEFormElementOptionselect ($o_country, "United States - Michigan", 1, "byText")
    
    
    
    $HTML = _IEBodyReadHTML ($o_IE)
    $Code = StringRegExp($HTML, "thecode"", '(.*?)', ""ENTRY_HUMANCHECK_ERROR", 3)
    If @extended Then
        $o_thecode = _IEFormElementGetObjByName ($o_Form, "thecode")
        _IEFormElementSetValue ($o_thecode, $Code[0])
        _IEFormSubmit ($o_Form)
        QuickOutput("IMVU.txt", _GetIP() & ": Success   " & TimerDiff($Begin), 1)
    Else
        QuickOutput("IMVU.txt", _GetIP() & ": ERROR", 1)
        ;Msgbox(0,"ERROR: Can't decrypt security code","Manually enter the code")
        ;Exit
    EndIf
    TrayTip("Proxy closed","Finished registering",10)
        $reg = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Cookies")
    FileDelete($reg & "\*imvu*.txt")
    
    Dim $oWinmgmts = ObjGet("winmgmts:{impersonationLevel=impersonate}")
    Dim $Proxies = $oWinmgmts.InstancesOf("Win32_proxy")
    For $Proxy In $Proxies
        $Proxy.SetProxySetting ("","" )
    Next
    UpdateProps()
    Sleep(150000)

WEnd








Func QuickOutput($Filename, $Output, $Mode)
    Local $File = FileOpen($Filename, $Mode)
    FileWriteLine($File, $Output)
    FileClose($File)
EndFunc

Func GenerateRandomName()
    Local $Let1 = Chr(Random(Asc("a"), Asc("z"), 1))
    Local $Let2 = Chr(Random(Asc("a"), Asc("z"), 1))
    Local $Let3 = Chr(Random(Asc("a"), Asc("z"), 1))
    Local $Let4 = Chr(Random(Asc("a"), Asc("z"), 1))
    Local $Let5 = Chr(Random(Asc("a"), Asc("z"), 1))
    Local $Let6 = Chr(Random(Asc("a"), Asc("z"), 1))
    Local $Let7 = Chr(Random(Asc("a"), Asc("z"), 1))
    Return $Let1 & Random(1, 9, 1) & Random(1, 9, 1) & $Let2 & $Let3 & Random(1, 9, 1) & $Let4 & $Let5 & $Let6 & Random(1, 9, 1) & Random(1, 9, 1) & $Let7
EndFunc

Func UpdateProps()
    BlockInput(1)
    Run('control inetcpl.cpl',"", @SW_SHOW)
    WinWait('Internet Properties')
    WinSetState('Internet Properties', '', @SW_SHOW)

    Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{RIGHT}")
    WinWait("Internet Properties","Select a Web content")
    If Not WinActive("Internet Properties","Select a Web content") Then WinActivate("Internet Properties","Select a Web content")
    WinWaitActive("Internet Properties","Select a Web content")
    Send("{RIGHT}")
    WinWait("Internet Properties","Move the slider to s")
    If Not WinActive("Internet Properties","Move the slider to s") Then WinActivate("Internet Properties","Move the slider to s")
    WinWaitActive("Internet Properties","Move the slider to s")
    Send("{RIGHT}")
    WinWait("Internet Properties","Ratings help you con")
    If Not WinActive("Internet Properties","Ratings help you con") Then WinActivate("Internet Properties","Ratings help you con")
    WinWaitActive("Internet Properties","Ratings help you con")
    Send("{RIGHT}")
    WinWait("Internet Properties","To set up an Interne")
    If Not WinActive("Internet Properties","To set up an Interne") Then WinActivate("Internet Properties","To set up an Interne")
    WinWaitActive("Internet Properties","To set up an Interne")
    Send("{TAB}{TAB}{TAB}{TAB}{ENTER}")
    WinWait("Local Area Network (LAN) Settings","Automatic configurat")
    If Not WinActive("Local Area Network (LAN) Settings","Automatic configurat") Then WinActivate("Local Area Network (LAN) Settings","Automatic configurat")
    WinWaitActive("Local Area Network (LAN) Settings","Automatic configurat")
    Send("{ENTER}")
    WinWait("Internet Properties","To set up an Interne")
    If Not WinActive("Internet Properties","To set up an Interne") Then WinActivate("Internet Properties","To set up an Interne")
    WinWaitActive("Internet Properties","To set up an Interne")
    Send("{TAB}{ENTER}")
    BlockInput(0)
EndFunc

Share this post


Link to post
Share on other sites



I think you'd make a dllcall to WININET.DLL.

Somthing like -

DllCall("WININET.DLL","int","INTERNET_OPTION_REFRESH")

major shot in the dark though as i have no experiance with this. But it seems that it's the DLL you want at least.

Share this post


Link to post
Share on other sites

According to

http://msdn.microsoft.com/library/default....ption_flags.asp

and

http://support.microsoft.com/?id=226473

I think it would be something like these two:

DllCall("WININET.DLL","int","InternetSetOption", "none","null","str","INTERNET_OPTION_SETTINGS_CHANGED","none","null","int","0")
    DllCall("WININET.DLL","int","InternetSetOption", "none","null","int","INTERNET_OPTION_REFRESH","none","null","int","0")

Except I dont know how to call the the type of the option. I tried using the flag as said by one website, but it still didn't work. I have no idea about Dllcalls and what not. Hopfully someone can come around and help me.

Looking over some functions on the site it seems you can set the proxy settings for certain instances. That would be better yet to set the instance of IE that autoit calls to use the proxy, but not normal IE. The person I am making this script for demands to use IE WHILE the script is running, so i cant have it use a global proxy all the time.

Share this post


Link to post
Share on other sites

Here's the thing- that function has some required arguments that may be diffacult to get from within autoit. There are custom data types in there (like a handle to the internet instice that was previously opened with 'InternetOpen') that are depentent more on working with the wininet library rather than step by step dll calls. (kinda the same reason for no OpenGL in autoit yet :whistle:). Someone ELSE may be able to help you there but it seems your trying to do somthing in autoit that could best be done in a C dialect for which the library was designed.

Maybe this isn't the best way...

On the other hand, some DLLstruct,call guru may be able to patch it together for you...

:)

Share this post


Link to post
Share on other sites

wouter's inetgetsource uses the internetopen handle i believe. plus the call with that function is null to everything but the options thing. I think i can call it with flags, too.

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  
Followers 0