Sign in to follow this  
Followers 0
Armand

perform Javascript calls on a webpage - HOW ?

7 posts in this topic

well... i would like to automate a Javascript function after i've already loaded a document... is there anyway to automate it?!

i mean i know how i can do it manualy - just surf to a webpage then write it in address bar and press enter... but i want to do it all automatically through OBJs and so - is there a way ?!

ANY HELP WILL BE APPRECIATED - THANKS IN ADVANCE !


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites



Well if you do it that way, then using _IECreate("address") should do the job.. right?

Share this post


Link to post
Share on other sites

noep... couse what u've just mentioned tries to actually suft to that address...

while when doing so in IE, it's just running the JS function since IE recognises it.

it can be achived however by making an IE window and automatically write down in the address bar and send an ENTER or something... but i want to call in HIDDEN... through an OBJ / TCP send... or something like that.....


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites

If we're on the same page then I did figure out a way to do this (was having a hard time with it). You're essentially wanting to call a javascript function, through the IE object, with AutoIt, right? The only way I was able to do this, was to use Javascripts setTimeout to call the function for me. It's very simple though. Say the page you want to interact with has a function called doMessage() that takes a string as a parameter. You would do it like this:

$oIE = _IECreate('http://URL...')
$oIEDoc = _IEDocGetObj($oIE)
$oIEDoc.parentwindow.setTimeout('doMessage("This is the message!")', 0)

Hope that helps.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

There is also eval and execScript. The former brings back a return value, the later does not. Some have also used _IENavigate.

$oIE.document.parentwindow.execScript('var x = 9; alert(x * 12);')

$result = $oIE.document.parentwindow.eval('var x = 9; x * 12;')

MsgBox(0, "Result", $result)

Dale

Edit: typo

Edited by DaleHohm
1 person likes this

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

@DEAR ALL-MIGHTY 'DaleHohm'

thanks alot for u'r reply was hoping to see it pops :wub:

anyhow, if i do use _IE, how if at all possible, can one ask/send authentication without having the so so annoying IE authentication pop-up window ?! :P

Please help a poor earthen... :)

:blink:


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites

IE used to allow username and password to be passed in the URL as http://fu.bar.com/test.htlm:username@password however that was removed serveral IE releases ago for security reasons.

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

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  
Followers 0