EmptySpace Posted June 3, 2013 Posted June 3, 2013 (edited) Long ago I tried to make program where I could fastly change user agent for IE embedded object in GUI. Now when I need to change it again I found that my user agent string is full of unneeded strings: Mozilla/4.0 (c; MSIE 7.0; cx; Trident/4.0; BTRS123646; GTB7.4; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SIE-ME75/22 UP.Browser/7.0.2.2.d.7(GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1) With this method: http://www.door2windows.com/how-to-change-internet-explorer-user-agent-string-in-all-versions-of-internet-explorer-without-any-tool/ I added '; SIE-ME75/22 UP.Browser/7.0.2.2.d.7(GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1)" but now cant delete leaving blank in custom string imputbox. Also tried: http://www.zytrax.com/tech/web/change-ua.html Both ways wont work. Ie addon http://www.iegallery.com/Addons/Details/2040 works how I want but it wont change UA in embedded object. Any ideas? How I can restore my UA to default if that 2 ways dont work? (Check your UA here http://www.useragentstring.com/) Edited June 3, 2013 by SherminatoR
guinness Posted June 3, 2013 Posted June 3, 2013 HttpSetUserAgent.Search the Forum as I've documented a bit about the correct usage. 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
DW1 Posted June 3, 2013 Posted June 3, 2013 Can't you also just remove the additional information from the registry? HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet Settings5.0User AgentPost Platform AutoIt3 Online Help
EmptySpace Posted June 3, 2013 Author Posted June 3, 2013 (edited) HttpSetUserAgent. Search the Forum as I've documented a bit about the correct usage. "Sets the user-agent string sent with InetGet() and InetRead() requests." Can I make it to work with _IECreateEmbedded() in direct browsing? not only for inet funcs? Can't you also just remove the additional information from the registry? HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet Settings5.0User AgentPost Platform Its empty Edited June 3, 2013 by SherminatoR
trancexx Posted June 3, 2013 Posted June 3, 2013 How about something like this: Global Const $sLink = "http://whatsmyuseragent.com/" Global $oObj = ObjCreate("Shell.Explorer.2") GUICreate("Test User-Agent String", 700, 500) GUICtrlCreateObj($oObj, 10, 10, 680, 480) GUISetState() $oObj.Navigate2($sLink, Default, Default, Default, 'User-Agent: "My super special user agent string."') While GUIGetMsg() <> -3 WEnd ♡♡♡ . eMyvnE
EmptySpace Posted June 3, 2013 Author Posted June 3, 2013 (edited) How about something like this: Global Const $sLink = "http://whatsmyuseragent.com/" Global $oObj = ObjCreate("Shell.Explorer.2") GUICreate("Test User-Agent String", 700, 500) GUICtrlCreateObj($oObj, 10, 10, 680, 480) GUISetState() $oObj.Navigate2($sLink, Default, Default, Default, 'User-Agent: "My super special user agent string."') sleep(1500) _IENavigate($oIE,"http://www.useragentstring.com/") While GUIGetMsg() <> -3 WEnd I need my user agent changed all time. #include <IE.au3> Global Const $sLink = "http://useragentstring.com/" GUICreate("Test User-Agent String", 700, 500) _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 680, 480) _IENavigate($oIE,"http://www.useragentstring.com/") sleep(1000) GUISetState() $oIE.Navigate2($sLink,Default, Default, Default, 'User-Agent: My super special user agent string.') While GUIGetMsg() <> -3 WEnd If I refresh page then I see my old ua.. Edited June 3, 2013 by SherminatoR
mikell Posted June 3, 2013 Posted June 3, 2013 This should work #include <IE.au3> GUICreate("Test User-Agent String", 700, 500) _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 680, 480) _SetUserAgent('User-Agent: My super special user agent string.') _IENavigate($oIE,"http://www.useragentstring.com/") sleep(1000) GUISetState() While GUIGetMsg() <> -3 WEnd 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 trancexx 1
EmptySpace Posted June 4, 2013 Author Posted June 4, 2013 This should work #include <IE.au3> GUICreate("Test User-Agent String", 700, 500) _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 680, 480) _SetUserAgent('User-Agent: My super special user agent string.') _IENavigate($oIE,"http://www.useragentstring.com/") sleep(1000) GUISetState() While GUIGetMsg() <> -3 WEnd 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 It works! Thanks
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