d4rkdz Posted April 15, 2013 Posted April 15, 2013 hello guys , sorry for always troubling you , i've got a problem with internet explorer user agent , to put it simply i want a way to change,i found a piece of code that change the useragent but it only works on embedded ie , because it only affects the running process AFAIK i would've settled for this if not for the popup blocker not working when ie is embedded. i've also tried the __IENavigate() function , but it only works for one request it doesn't even affect iframes __IENavigate ($oIE,$url, 1, 0, "", "", "User-Agent:"&$agent & @CRLF)
Bert Posted April 15, 2013 Posted April 15, 2013 Use IEAttach first The Vollatran project My blog: http://www.vollysinterestingshit.com/
d4rkdz Posted April 17, 2013 Author Posted April 17, 2013 Use IEAttach firstcan you please provide further explanation for i am still a noob
Decipher Posted April 17, 2013 Posted April 17, 2013 d4rkdz, Click on the function name to view the online documentation which is also in the help file included with the installation of AutoIt3. _IEAttach() Anonymous Spoiler
d4rkdz Posted April 17, 2013 Author Posted April 17, 2013 (edited) d4rkdz, Click on the function name to view the online documentation which is also in the help file included with the installation of AutoIt3. _IEAttach() Anonymous i did and i ended up with this code which still doesn't do the job #include 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 _SetUserAgent("agent") $t= _IEAttach("google") MsgBox(0, "The URL", _IEPropertyGet($t, "locationurl")) _IENavigate($t, "http://whatsmyuseragent.com") Edited April 17, 2013 by d4rkdz
Decipher Posted April 17, 2013 Posted April 17, 2013 d4rkdz, Try this code and report any errors. #include <IE.au3> Local $oIE = _IEAttach("Google", "embedded") If @error Then ConsoleWrite("Could not get a handle to the IE object. Error: " & @error & @CRLF) EndIf MsgBox(0, "The URL", _IEPropertyGet($oIE, "locationurl")) _IENavigate($oIE, "https://ww.google.com", 1) ; Wait for the page to load before returning If @error Then ConsoleWrite("Failed to navigate to specified window. Error: " & @error & @CRLF) EndIf Anonymous Spoiler
guinness Posted April 17, 2013 Posted April 17, 2013 Using internal functions in a UDF is a massive no no! The reason being is if a Dev or MVP decides to change the internal function, then there is no obligation to report the change compared to a UDF (documented) function. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Decipher Posted April 17, 2013 Posted April 17, 2013 d4rkdz, Please refrain from using racist remarks/hints in your posts. You may have found it humorous but other may not. Anonymous Spoiler
guinness Posted April 17, 2013 Posted April 17, 2013 (edited) I personally can't see anything wrong with their posts. Edit: OK, now I saw what could have been perceived with bad intentiona, but it didn't cross my mind like that. Edited April 17, 2013 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
d4rkdz Posted April 17, 2013 Author Posted April 17, 2013 d4rkdz,Please refrain from using racist remarks/hints in your posts. You may have found it humorous but other may not.Anonymousoh i did not mean it in such a way at all sir , let me edit it
Decipher Posted April 17, 2013 Posted April 17, 2013 d4rkdz, That is more appropiate. Thank You Anonymous Spoiler
d4rkdz Posted April 17, 2013 Author Posted April 17, 2013 d4rkdz, Try this code and report any errors. #include <IE.au3> Local $oIE = _IEAttach("Google", "embedded") If @error Then ConsoleWrite("Could not get a handle to the IE object. Error: " & @error & @CRLF) EndIf MsgBox(0, "The URL", _IEPropertyGet($oIE, "locationurl")) _IENavigate($oIE, "https://ww.google.com", 1) ; Wait for the page to load before returning If @error Then ConsoleWrite("Failed to navigate to specified window. Error: " & @error & @CRLF) EndIf Anonymous still what i want is to change the user agent and not to use an existing window to navigate so i don't see how does this help .
Decipher Posted April 17, 2013 Posted April 17, 2013 (edited) d4rkdz,There is a registry setting for that. Would you mind installing an addon? http://www.howtogeek.com/howto/18450/change-the-user-agent-string-in-internet-explorer-8/Anonymous Edited April 17, 2013 by Decipher Spoiler
d4rkdz Posted April 17, 2013 Author Posted April 17, 2013 d4rkdz, There is a registry setting for that. Would you mind installing an addon? http://www.howtogeek.com/howto/18450/change-the-user-agent-string-in-internet-explorer-8/ Anonymous i thought that ie(8 and above) user-agent can't be changed from the registry anymore as for the addon , UAPick crossed my mind already , however i couldn't operate it using autoit , i got to set it up , still i couldn't change the user agent using autoit , all i found was some registry keys RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER\S-1-5-21-1285864041-2306270481-2997880768-1000\Software\Bayden Systems\UAPick","OverrideEnabled","REG_DWORD",1) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER\S-1-5-21-1285864041-2306270481-2997880768-1000\Software\Bayden Systems\UAPick","OverrideUA","REG_SZ","agent")
Decipher Posted May 5, 2013 Posted May 5, 2013 I can't seem to find anything to helpful other than registry related stuff. Read http://www.enhanceie.com/ua.aspx Allegedly IE8+ will send a short version of the UA string stored in the registry. Read http://msdn.microsoft.com/en-us/library/ms537503%28v=VS.85%29.aspx?ppud=4#UARegistry If an IE process is running when you write the registry changes that will not take effect immediately and once the process finishes the registry settings will be overwritten with the ones currently being stored in memory. Ensure that there aren't any IE processes running before attempting to modify the registry configuration. I have read reports where users running IE8 and have changed the UA string VIA registry successfully however in some cases the changes are undone after a reboot. If you have problems than write the appropiate keys in HKLM, HKCU and if Mozilla Firefox isn't an option for you which it should be then create a startup script to reset the configuration. I would put a script of that time in HKLMSoftwareMicrosoftWindowsCurrent VerstionRun <- I'm really calling that path from memory so don't quote me but its not to hard to find. This are the keys that need to be changed. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent] "Version"="MSIE 8.0" "Platform"="Windows NT 6.0" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform] "SV1"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version Vector] "IE"="8.0000" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent] "Version"="MSIE 8.0" "Platform"="Windows NT 6.0" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform] "SV1"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector] "IE"="8.0000" Here is another example of what can be written in the first location in reg script above. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent default: Mozilla/5.0 Compatible: Windows; U Version: Windows NT 5.1 Platform: en-US; rv:1.7.12 If you can't utilize this information than I'm going to advise you look at the IE object which has a member function to set the UA string but I'm thinking thats per session wise. Spoiler
wisem2540 Posted May 5, 2013 Posted May 5, 2013 Im just wondering, are you using this to download files? If so, you could use HTTPSETUSERAGENT with Inetget
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now