Sign in to follow this  
Followers 0
Andrew

Script Wait; Continue On Click

13 posts in this topic

I am using AutoIt to automate series of button clicks, as well as input of redundant information into an application. There are, however, areas which will require user intervention (eg. selection of specific line item, such as name, within the app). Ideally, the script would go thru a series of steps, pause for line item selection, then continue.

Newbie question: How would I make to script pause/wait/sleep until a line item is selected?

Thanks!

Share this post


Link to post
Share on other sites



you can pause the script, or you can have a msgbox pop up asking to continue, or a input box asking for info.

there are almost too many options to choose.

For instance, I rename a web page, then click, and when it reloads, it has a new name, thus I can winwait for that new name before continuing.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Could you give me an example of how to pause (and restart) the script? The other alternatives suggested don't really seem practical... all I'm wanting to do is pause until the user selects a name (which could take as little as 5 seconds, but could take much longer depending on the user).

Ideally, if it could simply wait for a keyclicke event, that would be great.

Thanks!

Edited by Andrew

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

the pause() function given will pause until the Pause button is pressed.

Not perfect, but an example of how to use it.

Hotkeyset("{pause}","pause")
$pause=1
; code
msgbox(1,"","Going to pause until you hit the Pause key after you close this")
pause()
; other stuff
msgbox(1, "thanks for playing","")


func pause()
$pause=NOT $pause
while NOT $pause
sleep(10)
tooltip("Paused till you hit Pause")
wend
tooltip("")
endfunc
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Can AutoIt be made to wait (loop?) until a particular field becomes non-NULL? In this case, once a name is selected within the app, there are some previously empty fields that become populated. If AutoIt can detect there is now data, perhaps that could be catalyst to break the loop and continue. Sound feasible?

Thanks!

Share this post


Link to post
Share on other sites

Can AutoIt be made to wait (loop?) until a particular field becomes non-NULL?  In this case, once a name is selected within the app, there are some previously empty fields that become populated.  If AutoIt can detect there is now data, perhaps that could be catalyst to break the loop and continue.  Sound feasible?

Thanks!

If its a control you can do that ....

have a look at : ControlGetText ( "title", "text", "classnameNN" )


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

It is evidently not a control (whatever a control is). I used the following code:

$i = ControlGetText("Clarify - ClearSupport - [Incoming Call]", "", "Edit1")
MsgBox(0, "Text read was:", $i)
While NOT $i
MsgBox(0, "Text read was:", $i)
Sleep(200)
WEnd

I get "Text read was:" and nothing.

Perhaps I'm doing something wrong?

Edited by Andrew

Share this post


Link to post
Share on other sites

It is evidently not a control (whatever a control is).  I used the following code:

$i = ControlGetText("Clarify - ClearSupport - [Incoming Call]", "", "Edit1")
MsgBox(0, "Text read was:", $i)
While NOT $i
MsgBox(0, "Text read was:", $i)
Sleep(200)
WEnd

I get "Text read was:"  and nothing.

Perhaps I'm doing something wrong?

did you use AU3_Spy.exe to determine the control's name ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

did you use AU3_Spy.exe to determine the control's name ?

Yes. Edit1 is the 'Class' shown under "Last Control Under Mouse" when I click that field in the app.

Share this post


Link to post
Share on other sites

what about something like this to try out :

While ControlGetText("Clarify - ClearSupport - [Incoming Call]", "", "Edit1") = ""
    MsgBox(0, "Text read was:", $i,1)
WEnd

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

what about something like this to try out :

While ControlGetText("Clarify - ClearSupport - [Incoming Call]", "", "Edit1") = ""
   MsgBox(0, "Text read was:", $i,1)
WEnd
Same thing. No text.

Share this post


Link to post
Share on other sites

Just so i understand:..

Does it contain any text at the moment you run the script ??

What did AU3_Spy.exe show when you check it , it tells you what he text is..


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Just so i understand:..

Does it contain any text at the moment you run the script ??

The script first initiates a ^+I sequence to open the app window, populates an id field (using ControlSetText) and presses a button (ControlClick). At this point, the list of names appears, and the Class 'Edit1' (firstname), 'Edit2' (lastname), among others, are blank (not to mention grey'd out -- they are not editable). Once a name is selected, these fields are populated by the app db.

What did AU3_Spy.exe show when you check it , it tells you what he text is..

I'm not sure what text you are asking about. The 'Visible Window Text' section is rather extensive, as the page itself is rather populated with data. I was simply trying to key on something in particular that I know changes once a name is selected.

Hope this helps.

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