Sign in to follow this  
Followers 0
anand

Auto IT function for focus a control in a web page.

9 posts in this topic

Hi,

is any auto it function available to set the focus to a specific control in a web application?

Regards!

Anantharajan.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

is any auto it function available to set the focus to a specific control in a web application?

Regards!

Anantharajan.

Don't let the dog eat your help file!

ControlFocus()

:P

Edit: Oops, a little to quick with the snarky reply (web page, not GUI), but it's still in your help file: _IEAction() with "focus".

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Hi,

I want to give focus during run time. For example, one commandbutton is present in a web page. What i want to do is change focus to that control(command button) during runtime and this is not for the window which is created by Auto IT. Think if you have more than one IE opened then you don't have unique properties of Text, ID,class name etc.. So we cannot use this function for give focus. Since we do not get unique values.

Thanks,

Anand

Share this post


Link to post
Share on other sites

You will get different control id and text every time when you run the script. So we don't have any fixed control id or text for our script. We can not use this method in this situation. If you know how to solve this problem then reply immediately plz.

Share this post


Link to post
Share on other sites

i have a similar problem, i'm trying to press a website button automatically but the button does not have an id or name, so i can't use IEgetobjbyid or IEgetobjbyname

Welcome to my Tombola!  Great prizes to be won, just put your hand (or paw) in, pick up a tombola
ticket, and see what prize you win.  Anything ending with a <b>0, 2 or 5</b> is a winner!
<p>
You can play the Tombola <i>once per day</i>.  Please do not create multiple accounts in order to play the tombola,
<b>we will freeze people we see doing this because its cheating!</b>
<p>
<center>
<form action='tombola2.phtml' method='post'>
<input type='submit' value='Play Tombola!'>
</form>
</center>

<It Shall Be Done>

Share this post


Link to post
Share on other sites

huskies, in your case the button is the only element in the form. You could enumerate forms, take the first item, then enumerate the elements, take the first item which is your button.

and to set focus to an element you can _IEAction($oElem, "focus")

( i think )

Share this post


Link to post
Share on other sites

You will get different control id and text every time when you run the script. So we don't have any fixed control id or text for our script. We can not use this method in this situation.

Form elements like buttons in a web page do not have control IDs at all. They are Document Object Model (DOM) elements which IE gives AutoIt a COM Object interface to. You should be learning to use the IE.au3 UDF function ( _IE* ) in the help file to work with your page.

If you know how to solve this problem then reply immediately plz.

You really should try to not sound so desperate/demanding.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks for your information. Next time i will take care about words(desperate/demanding).

Can you please send me the code to identify control names present in a page. Please give me example for google page.

Share this post


Link to post
Share on other sites

Thanks for your information. Next time i will take care about words(desperate/demanding).

Can you please send me the code to identify control names present in a page. Please give me example for google page.

All of the _IE* functions in the help file have excellent example scripts. Run those first and see how the object references to the various elements are retrieved and used. There is no point in me writing duplicate demos when there are so many good ones in the help file.

I understand that after checking out all those example scripts, you may not understand everything, but you will be able to ask a more direct question. It's a learning curve worth climbing.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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