supadodger Posted March 23, 2009 Share Posted March 23, 2009 (edited) can you change autoit useragent? i know there are programs to manipulate IE's user agent. i was wondering if i could manipulate autoits user agent. Edited March 23, 2009 by supadodger Link to comment Share on other sites More sharing options...
TerarinK Posted March 23, 2009 Share Posted March 23, 2009 To manipulate IE user agent, you've got me confused then. Isn't user agents Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) because your using a WebBrowser, do correct me if I am wrong. You can change that at anytime you like to, which will affect autoits user agent if you declaring it to be a Web Browser. As for autoits it is more like, what you are declaring. TCP will carry more weight on it shoulder then, but I would just change the user agents as that is the easiest 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
supadodger Posted March 25, 2009 Author Share Posted March 25, 2009 To manipulate IE user agent, you've got me confused then. Isn't user agents Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) because your using a WebBrowser, do correct me if I am wrong. You can change that at anytime you like to, which will affect autoits user agent if you declaring it to be a Web Browser.As for autoits it is more like, what you are declaring. TCP will carry more weight on it shoulder then, but I would just change the user agents as that is the easiestaccording to the changelog autoit IE embeds useragent is AutoIT Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 (edited) Use this: $sProperties = $oIE.document.parentwindow.navigator.UserAgent MsgBox(0, "UserAgent", $sProperties) that will tell you what the window is. I can't find the changelog that says anything about autoit IE embeds useragent is "AutoIT" Edited March 25, 2009 by TerarinK 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
Authenticity Posted March 25, 2009 Share Posted March 25, 2009 (edited) He means the agent that is used in functions such as InetGet, etc... Edited March 25, 2009 by Authenticity Link to comment Share on other sites More sharing options...
TerarinK Posted March 26, 2009 Share Posted March 26, 2009 (edited) You can either check out this one http://www.autoitscript.com/forum/index.ph...st&p=551920 or this one that has a more HTTP delimited - http://www.autoitscript.com/forum/index.php?showtopic=29631 Edited March 26, 2009 by TerarinK 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
bwq Posted April 5, 2009 Share Posted April 5, 2009 Is it possible to change the user-agent from within the IE.au3 code? My program uses "$OIE = _IECreate("http://www.google.com", 0, $MDEBUG)" and I'd like to set the $OIE object's user agent because I'm using the $OEI to fill in forms and navigate to pages, I don't just have to read the pages (source) so I can't just create a stream and download the page. Link to comment Share on other sites More sharing options...
TerarinK Posted April 5, 2009 Share Posted April 5, 2009 Look under http://msdn.microsoft.com/en-us/library/ms537503.aspx it shows you how to edit it in the registry 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
bwq Posted April 8, 2009 Share Posted April 8, 2009 Look under http://msdn.microsoft.com/en-us/library/ms537503.aspx it shows you how to edit it in the registryThanks for the suggestion, though that won't work unless all IE windows are closed. It'd be far more convenient if I could just spoof it through the IE.au3. Link to comment Share on other sites More sharing options...
bwq Posted April 15, 2009 Share Posted April 15, 2009 Still looking for a good way to do this. I can do it when I use the Navigate function with a custom header, but when I click something it obviously won't work. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 19, 2009 Share Posted April 19, 2009 Set IE Registry options immediately: DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0) Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
bwq Posted April 25, 2009 Share Posted April 25, 2009 Set IE Registry options immediately:DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)DaleThanks for this! Just tried it out but it doesn't seem to set my user-agent though. On the page that Authenticity linked to, with all the InternetSetOption flags, I found that "39" notifies the system that there's been a change to the settings and have it update. I also found that 41 is the option to update the user-agent.Using your example dll call, I added one to change the user agent:$OIE = _IECreate("about:blank", 0, $SHOWIE)DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 41, 'str', 'test', 'long', 4) // InternetSetOption flag 41 updates the user-agent: INTERNET_OPTION_USER_AGENT:// Sets or retrieves the user agent string on handles supplied by InternetOpen and used in subsequent HttpSendRequest functions, as long as it is not overridden by a header added by HttpAddRequestHeaders or HttpSendRequest. This is used by // InternetQueryOption and InternetSetOption.DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)// Notifies the system that the registry settings have been changed so that it verifies the settings on the next call to InternetConnect. This is used by InternetSetOption.However, still no change in the user-agent, it still displays the regular IE user-agent. Help would be very much appreciated since this is the only thing that's keeping my application from being complete. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 25, 2009 Share Posted April 25, 2009 I don't have any experience with or need for what you are doing, so I have not dug into it. It works for some related settings, so it may do the trick for yours, but you should probably find another venue to ask a specialized question like this. If it is shown to be a specific interaction with AutoIt that you are having trouble with, then this is the place. If, as in this case, it is more likely to be an issue with the specific usage and foibles with a Windows component, I suggest another place -- like the MSDN forums -- where you'll have a much better chance of finding someone with the specific experience you need. We've given you some good ideas and leads. Take them and run with them. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
bwq Posted April 25, 2009 Share Posted April 25, 2009 I don't have any experience with or need for what you are doing, so I have not dug into it.It works for some related settings, so it may do the trick for yours, but you should probably find another venue to ask a specialized question like this. If it is shown to be a specific interaction with AutoIt that you are having trouble with, then this is the place. If, as in this case, it is more likely to be an issue with the specific usage and foibles with a Windows component, I suggest another place -- like the MSDN forums -- where you'll have a much better chance of finding someone with the specific experience you need.We've given you some good ideas and leads. Take them and run with them.DaleWell, I'd ask there if I was unsure of how to use it properly, but I'm not even sure if that DllCall is working. It should return true or false depending on the outcome but I'm not sure how to catch the boolean in AutoIt.I've tried using the following code, but that just gave me a blank string in the msgbox:$OUTPUT = DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'int', 39, 'str', 0, 'long', 0)MsgBox(0, "", $OUTPUT) Link to comment Share on other sites More sharing options...
DaleHohm Posted April 26, 2009 Share Posted April 26, 2009 Then suggest you open a new thread to ask questions specific to the function of DllCall. Those most likely to help you here with DllCall will be stepping over this thread. Once you are comfortable with that, then be prepared to take your WININET questions tot he MSDN forums. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
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