Jump to content
Sign in to follow this  
sandyd

Use IE Function to execute a javascript function

Recommended Posts

sandyd

Hi all,

Say I have a javascript function on a webpage called DoSomething(), how can I run that using the IE functions

I have already used the IE functions to get a reference to the IE application, and to some form elements withing the page, just need to fire off the DoSomething function?

Thanks in advance


----[ SandyD ]---

Share this post


Link to post
Share on other sites
autosc

Hi all,

Say I have a javascript function on a webpage called DoSomething(), how can I run that using the IE functions

I have already used the IE functions to get a reference to the IE application, and to some form elements withing the page, just need to fire off the DoSomething function?

Thanks in advance

this might give you ideas .....

#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

Share this post


Link to post
Share on other sites
sandyd

The code in the webpage is this:

<input type="button" class="button" value="Go &gt;&gt;" onclick="handleremctrlclick();">

as you can see there is no name for the button, so how can I click it?

Any help would be most appreciated.


----[ SandyD ]---

Share this post


Link to post
Share on other sites
DaleHohm

See the examples under _IEFormElementGetCollection using the optional index value and then use _IEAction with "click" on that object.

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

Share this post


Link to post
Share on other sites
Vindicator209

I think it can be done with:

_IENavigate($oIE,"handleremctrlclick();")


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
DaleHohm

I think it can be done with:

_IENavigate($oIE,"handleremctrlclick();")

If it is an autonomous function this is true, but if the function retrieves info from current form values or pays attention to what button/object is clicked you'll have trouble.

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

Share this post


Link to post
Share on other sites
sandyd

Its ok ppl,

Found the code for the javascript function and managed to get the URL to follow through that.

Thanks for everyones help


----[ SandyD ]---

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×