wim Posted October 27, 2006 Share Posted October 27, 2006 I get a link, and click it! but the original page will show a window to say "Are you sure to logout? Yes/NO", this is maked by confirm function in javascript.$oBtnLogout = _IEGetObjByName($oIE, "idBtnLogout")_IELinkClickByIndex($oBtnLogout,0)MsgBox(0,"Title-1",@error);run up script,; i will never get the MsgBox-Title-1 ;until i click the "Are you sure to logout?" by hand!why? how ? Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 27, 2006 Share Posted October 27, 2006 Try restating the information. I can't understand what you are talking about. Link to comment Share on other sites More sharing options...
DaleHohm Posted October 27, 2006 Share Posted October 27, 2006 I get a link, and click it! but the original page will show a window to say "Are you sure to logout? Yes/NO", this is maked by confirm function in javascript. $oBtnLogout = _IEGetObjByName($oIE, "idBtnLogout") _IELinkClickByIndex($oBtnLogout,0) MsgBox(0,"Title-1",@error) ;run up script, ; i will never get the MsgBox-Title-1 ;until i click the "Are you sure to logout?" by hand! why? how ?It works like this: 1) Clicking the link triggers an onclick Javascript function. 2) AutoIt waits for the function to return a value. 3) the function does not return until you ack the alert You're stuck right? You cannot use AutoIt to click the button because it is stalled... Fortunately, AutoIt gives you another option. You can use the AutoIt Send (or ControlSend) command to activate the link without getting stuck in the COM call that initiates the Javascript routine. In your case: _IEAction("$oBtnLogout", "focus") Send("{Enter}") This activates the link, but returns control immediately back to AutoIt. You can then use AutoIt Win* commands to work with the popup alert and Send or ControlSend commands to click its buttons. There are several other threads in the forum that discuss this. You might search for ControlSend, _IEAction, focus and perhaps AdlibEnable to find them. Dale 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...
wim Posted October 27, 2006 Author Share Posted October 27, 2006 Thanks. I get it! BTW: _IEAction("$oBtnLogout", "focus") should be _IEAction($oBtnLogout, "focus") It works like this: 1) Clicking the link triggers an onclick Javascript function. 2) AutoIt waits for the function to return a value. 3) the function does not return until you ack the alert You're stuck right? You cannot use AutoIt to click the button because it is stalled... Fortunately, AutoIt gives you another option. You can use the AutoIt Send (or ControlSend) command to activate the link without getting stuck in the COM call that initiates the Javascript routine. In your case: _IEAction("$oBtnLogout", "focus") Send("{Enter}") This activates the link, but returns control immediately back to AutoIt. You can then use AutoIt Win* commands to work with the popup alert and Send or ControlSend commands to click its buttons. There are several other threads in the forum that discuss this. You might search for ControlSend, _IEAction, focus and perhaps AdlibEnable to find them. Dale Dale 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