jbg1978 Posted August 11, 2009 Share Posted August 11, 2009 I am attempting to use the InvokeScript method off of the IE document object. I have successfully done this in AutoIT before, but the script I was invoking in the past had no parameters. In VB you would call InvokeScript and pass in the name of the script as the first parameter and if there are arguments in the script, you would pass in an object array as the second parameter. The object array would consist of the arguments that the script needs in the same order that they need to be passed in. I can't figure out how to do this in AutoIT. I passed in an array that consisted of the arguments, but receive the error: "the requested action with this object has failed" on the document object. Does anyone have any experience or ideas around doing this? Thanks, Jason Link to comment Share on other sites More sharing options...
DaleHohm Posted August 11, 2009 Share Posted August 11, 2009 Func _IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc $s_eval is the Javascript you want to exevute. if you need a Javascript array, you cannot pass an AutoIt array... you can however use _IEEval to execute the Javascript to build a Javascript array and then reference it in your call to the Javascript that references the array (in the browser window context). 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...
jbg1978 Posted August 11, 2009 Author Share Posted August 11, 2009 Thank you Dale. I'll try that, but I misunderstood how to pass the arguments to the Javascript when going that route. Can you elaborate on that for me? Jason Link to comment Share on other sites More sharing options...
jbg1978 Posted August 12, 2009 Author Share Posted August 12, 2009 Dale, Have you had a chance to look at this further? Any help would be appreciated. Thanks, Jason Link to comment Share on other sites More sharing options...
DaleHohm Posted August 12, 2009 Share Posted August 12, 2009 Take a look at this post to see if it give you some ideas: how to prevent/control refresh, navigation or close of a webpageDale // 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