Sign in to follow this  
Followers 0
supadodger

can you change autoit useragent?

15 posts in this topic

#1 ·  Posted (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 by supadodger

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

according to the changelog autoit IE embeds useragent is AutoIT

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by TerarinK

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

He means the agent that is used in functions such as InetGet, etc...

Edited by Authenticity

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Set IE Registry options immediately:

DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

Dale

Thanks 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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Well, 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)

Share this post


Link to post
Share on other sites

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

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