Sign in to follow this  
Followers 0
azopardo

javascript onchange event

4 posts in this topic

Hi, I want to read a javascript text field just when it change its value to grab the value. Now I´m working with a while loop, but it is very CPU consuming. Is there other way to do? Perhaps using an onchange event of the field.

Here is my code:

$oIE = _IEAttach ($url,"URL")
$idUsuario="user_index_page_340"  ; ID name of the javascript text field
$oUsuario = _IEGetObjByName ($oIE,$idUsuario  )

While 1
    $Usuario = _IEPropertyGet($oUsuario, "innertext")
wend

Share this post


Link to post
Share on other sites



Hi, I want to read a javascript text field just when it change its value to grab the value. Now I´m working with a while loop, but it is very CPU consuming. Is there other way to do? Perhaps using an onchange event of the field.

Here is my code:

$oIE = _IEAttach ($url,"URL")
$idUsuario="user_index_page_340"  ; ID name of the javascript text field
$oUsuario = _IEGetObjByName ($oIE,$idUsuario  )

While 1
    $Usuario = _IEPropertyGet($oUsuario, "innertext")
wend

I would guess the way you are doing it is ok but adding a sleep in the while loop will reduce the cpu load a lot if you haven't already done that. Say Sleep(100) on the basis that most people can't type more than 10 characters a second.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I would guess the way you are doing it is ok but adding a sleep in the while loop will reduce the cpu load a lot if you haven't already done that. Say Sleep(100) on the basis that most people can't type more than 10 characters a second.

Thanks Martin, I have tried that, the text field is continuesly changed by the web page itself, and I have to trigger a posterior function on that change so I was hoping there was an "onchange" event to make it easier.

Cheers

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

See _IEHeadInsertEventScript and its examples.

Dale

Edited by DaleHohm

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