Exit Posted October 12, 2016 Share Posted October 12, 2016 (edited) [Problem solved. See post #7 ] I have written a script for SEO (Search engine optimizing). It is running fine on desktop. Now I would like to emulate a smartphone on the google search page. How to tell IE to use the screen size of a smartphone? Didn't found a solution in IE.AU3 Any advice? TIA Exit Edited October 31, 2016 by Exit Prolem solved App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Danyfirex Posted October 12, 2016 Share Posted October 12, 2016 I'm not sure what you mean. If you mean to tell to a webpage that you're from a smartphone you can do it changing your User Agent to Phone's one. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Exit Posted October 12, 2016 Author Share Posted October 12, 2016 @Danyfirex Yes, I want to do that. How to change User Agent to a smartphone? I found a method by using F12 (developers tool), but there must be a more programatical way. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Danyfirex Posted October 12, 2016 Share Posted October 12, 2016 You can do this. #include <IE.au3> Local $oIE = _IECreate() Sleep(1000) $oIE.Navigate2("http://www.useragentstring.com/", Default, Default, Default, _ "User-Agent: Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537") Saludos Exit 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 12, 2016 Share Posted October 12, 2016 (edited) HttpSetUserAgent("MyUserAgent") Wouldn't using this be simpler? Edited October 12, 2016 by Blue_Drache Exit 1 Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Exit Posted October 12, 2016 Author Share Posted October 12, 2016 Many thanks to Danyfirex and Blue_Drache It gave me a pointer to dig further. I want to emulate a 4" screen (800x400). This is possible when using F12 and click on resolution. See this screenshot: How to achive this sizing with UserAgent ? App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Exit Posted October 31, 2016 Author Share Posted October 31, 2016 OK, I got a solution: #include <IE.au3> $oIE = _IECreate() $hIE = _IEPropertyGet($oIE, "hwnd") ControlSend($hIE, "", "", "{F12}") Sleep(1000) ControlSend("[Class:F12FrameWindow]", "", "", "^{F7}{TAB 3}{down}{TAB 3}{up 9}{down}") _IENavigate($oIE, "http://www.google.com/#num=100&q=autoit+jon") WinActivate($hIE) MsgBox(262144, Default, "click 'OK' to close IE Test window", 0) _IEQuit($oIE) Danyfirex 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Exit Posted November 2, 2016 Author Share Posted November 2, 2016 Solution was not working. Ctrl+F7 was wrong. Should be Ctrl+7 Here the correct script: ; ; Switch IE Browser to mobile and back. #include <IE.au3> $oIE = _IECreate() $hIE = _IEPropertyGet($oIE, "hwnd") ControlSend($hIE, "", "", "{F12}") Sleep(1000) ControlSend("[Class:F12FrameWindow]", "", "", "^7") ControlSend("[Class:F12FrameWindow]", "", "", "{TAB 3}{down}{TAB 3}{up 9}{down}") _IENavigate($oIE, "http://www.google.com/#num=100&q=autoit+jon") WinActivate($hIE) MsgBox(262144, Default, "click 'OK' to return to desktop mode", 0) WinClose("[Class:F12FrameWindow]") MsgBox(262144, Default, "click 'OK' to close IE Test window", 0) _IEQuit($oIE) App: Au3toCmd UDF: _SingleScript() 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