; NetSession 0.9b UDF by Synthetisoft (www.Synthetisoft.com) - AutoIt forum user: drego ; For updates and details on usage visit http://www.autoitscript.com/forum/topic/166902-netsession-udf-new-net-capabilites-for-autoit-processes/ #Include #include #include Func _SetProxy($proxy, $proxybypass = "") Local $INTERNET_OPTION_PROXY = 38 Local $INTERNET_OPEN_TYPE_PROXY = 3 Local $tBuff = DllStructCreate("dword;ptr;ptr") DllStructSetData($tBuff, 1, $INTERNET_OPEN_TYPE_PROXY) Local $pproxy = DllStructCreate("char[" & (StringLen($proxy) + 1) & "]") DllStructSetData($pproxy, 1, $proxy) DllStructSetData($tBuff, 2, DllStructGetPtr($pproxy)) Local $pproxybypass = DllStructCreate("char[" & (StringLen($proxybypass) + 1) & "]") DllStructSetData($pproxybypass, 1, $proxybypass) DllStructSetData($tBuff, 3, DllStructGetPtr($pproxybypass)) $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", $INTERNET_OPTION_PROXY, "ptr", DllStructGetPtr($tBuff), "dword", DllStructGetSize($tbuff), "dword", 0) EndFunc Func _SetUserAgent($agent) $agentLen = StringLen($agent) Dim $tBuff = DllStructCreate("char["&$agentLen&"]") DllStructSetData($tBuff, 1, $agent) $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", 0x10000001, "ptr", DllStructGetPtr($tBuff), "dword", $agentLen, "dword", 0) EndFunc Func _ClearCookies() ShellExecuteWait("RunDll32.exe","InetCpl.cpl,ClearMyTracksByProcess 2") $cookieFolders = _FileListToArray(@AppDataDir&"\Macromedia\Flash Player\#SharedObjects","*",2) If @error Then Return "nonetorm" Else _ArrayDelete($cookieFolders,0) For $i = 0 To UBound($cookieFolders) -1 $siteFolders = _FileListToArray(@AppDataDir&"\Macromedia\Flash Player\#SharedObjects\"&$cookieFolders[$i],"*",2) If $i = 0 Then _ArrayDelete($siteFolders,0) EndIf For $j = 0 To UBound($siteFolders) -1 DirRemove(@AppDataDir&"\Macromedia\Flash Player\#SharedObjects\"&$cookieFolders[$i]&"\"&$siteFolders[$j],1) Next Next EndIf Return "cookiesremoved" EndFunc