crashdemons Posted January 6, 2008 Share Posted January 6, 2008 (edited) Is there any other way to way call javascript functions on-demand in an embedded IE object (meaning not dependent on webpage events but rather program conditions) than using _IENavigate ? The reason I ask is, I wanted to make a chatscreen for chat client I made. I found RTF controls hard to work with (licensing issues and problems trying to get them to work for everyone) So I switched to an HTML chatscreen (using on-page javascript to add new posts in their own elements) I can find no way to call my function ("java script:addchat(user, text, extendedinfo)") without using _IENavigate. While this works, I get an annoying click (the navigate sound) every time I call the javascript function through navigate. Rather than disable the navigate sound, is there a way to "silently" call a javascript function from AutoIt3 ? Keep in mind the webpage being used is a static file, not written to 'about:blank'. Thanks Edited January 6, 2008 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
DaleHohm Posted January 6, 2008 Share Posted January 6, 2008 See here: #452387Dale 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...
crashdemons Posted January 7, 2008 Author Share Posted January 7, 2008 execScript works wonderfully, thanks. My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
Zinefer Posted March 19, 2009 Share Posted March 19, 2009 Just curious, is this in the help file anywhere? I couldn't seem to find it, although it did work. Link to comment Share on other sites More sharing options...
Andrew Peacock Posted May 18, 2009 Share Posted May 18, 2009 Just curious, is this in the help file anywhere? I couldn't seem to find it, although it did work. Hi, Sorry to dig up an old post, but I thought the ensuing discussion (if anyone can help) might be useful. I'm trying to fire the onkeyup event for an input box. I've tried $field = _IEGetObjById($oIE, "Passwd") $field.fireEvent("onkeyup") $oIE.document.parentwindow.execScript("CreateRatePasswdReq('createaccount');") $inputs = _IETagNameGetCollection ($oDoc, "input") $inputs.item("Passwd").fireEvent("onkeyup") And probably a few other things I've forgotten about. The HTML I'm trying to do this for is <input type="password" name="Passwd" id="Passwd" size="30" onkeyup="CreateRatePasswdReq('createaccount')"/> Any help would be VERY appreciated, Regards, Andy Link to comment Share on other sites More sharing options...
DaleHohm Posted May 18, 2009 Share Posted May 18, 2009 I'd recommend creating a new thread instead of reviving a dead one. I expect the uses of fireEvent you have above to cause the event to be fired. You'll need to look carefully at the CreateRatePasswdReq function however to see what it is doing... it may be looking at the 'evt' object to get keycodes and the like and therefore just getting onkeyup to fire is not enough. 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...
Andrew Peacock Posted May 18, 2009 Share Posted May 18, 2009 Ah, some further testing sheds some light. If I use the following trimmed-down autoit code: #include <IE.au3> ; Pass the window to Autoit ;$oIE = _IECreate("http://localhost/test.html", 0, 1, 1,1) $oIE = _IEattach("test.html") $field = _IEGetObjById($oIE, "Passwd") $field.fireEvent("onkeyup") On this HTML page: <head> <body> <form id="test"> <input type="password" name="Passwd" id="Passwd" size="30" onkeyup="alert('test');" /> </form> </body> </html> I get this error: D:\My Documents\data\My Products\Social Bookmarker\Source Code\Autoit\test.au3 (10) : ==> Variable must be of type "Object".: $field.fireEvent("onkeyup") $field^ ERROR BUT... If I use IECreate to open a new window, there is no error and the javascript runs. This fits with my full application, as I'm using IEattach. However, I still can't get the full application to trigger the javascript. (there are no js errors generated as far as I can tell, so I'm assuming it's not running at all). Andy Link to comment Share on other sites More sharing options...
DaleHohm Posted May 18, 2009 Share Posted May 18, 2009 If $field is not an object, you should have gotten a NOMATCH error from the _IEGetObjById. Either that or the page is not quiescent (it's changing while you try to access it). Are you running with F5 in SciTe so that you'll see the console messages? 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...
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