monogeo Posted February 4, 2013 Posted February 4, 2013 (edited) I am able to launch IE using a different user via runas successfully; however, I cannot control it via _IECreate and _IEAttach. For example, I log on a windows 2008 R2 server as a user - administrator, then run these: RunAs("testuser", "mydomain", "password", 1, "c:\Program Files (x86)\Internet Explorer\iexplore.exe https://test.mydomain.com") or Run("C:\Windows\system32\cmd.exe") WinWaitActive("Administrator:C:\Windows\system32\cmd.exe","",1) Send('runas /profile /user:mydomain\testuser "c:\Program Files (x86)\Internet Explorer\iexplore.exe https://test.mydomain.com"{ENTER}') Send("password{ENTER}") The IE is launched and goes to https://test.mydomain.com properly. Then I try to control it using: $ie = _IEAttach("mydomain") ;mydomain is a substring of the page's title or $ie = _IECreate("https://test.mydomain.com", 1)_IEQuit($ie)But _IEAttach returns @error = 7 (No Match) and _IECreate returns @extended = 0 (fail to attach to an existing window). Looks like both _IEAttach and _IECreate cannot see any windows created by other users. Is there a way I can do this? Thanks! Edited February 4, 2013 by monogeo
DaleHohm Posted February 4, 2013 Posted February 4, 2013 You might try using _IEAttach with the embedded mode. This is the same thing you must do with HTA applications. It is a security zone issue, 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
monogeo Posted February 4, 2013 Author Posted February 4, 2013 Thanks Dale. I tried your suggestion: $ie = _IEAttach("mydomain", "embedded") and $ie = _IEAttach("[REGEXPTITLE:mydomain; INSTANCE:1]", "embedded", 1) But both failed with this: @error = 7 (No Match) and @extended = 1 The runas command successfully launched IE and only one IE windows running. Am I missing any other steps? Thanks!
DaleHohm Posted February 5, 2013 Posted February 5, 2013 Looks like you are doing it correctly. You may want to try to insure your selection criteria is correct by trying it with something like WinGetHandle. Other than that, you may need to run your AutoIt script under the same username as the browser. 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
Gianni Posted February 6, 2013 Posted February 6, 2013 (edited) try like this..... maybe?..... Bye #include <IE.au3> $ie_handle1 = winactivate("[CLASS:IEFrame]") ; get iexplore handle $oIE = _IEAttach($ie_handle1 ,"HWND" ) ; reference to $o_object ConsoleWrite( _IEPropertyGet( $oIE, "locationurl") & @crlf) ; url of the displayed web page Edited February 6, 2013 by Pincopanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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