Sign in to follow this  
Followers 0
tsystems

WaitClick(timeout) ??

13 posts in this topic

I can't seem to find a way to have a script pause until I click somewhere and then continue running / end. Surely there is a way to do this?

Share this post


Link to post
Share on other sites



MsgBox will do this...

Sorry, I was not clear. I need to place the cursor on a specific line of text so the rest of the script will act on the text from that particular spot.

Share this post


Link to post
Share on other sites

Where is this "specific line of text" in what application, on what control?

 

The text can be random bodies of text on web pages or in email. I'd like this to work anywhere.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

The text can be random bodies of text on web pages or in email. I'd like this to work anywhere.

Crikey!

You have an enormous project on your hands then.

The reason being that text is extracted differently on almost all controls, for example it's microsoft word, you need code to identify the control, extract text from it, determine if the cursor is over required text.

Then do that with every application you can think of, and you're nearly there.

I think flash objects and images will be your biggest hiccups.

I'd never get into such a thing myself, but wish you the best of luck.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Aaahhh... that makes more sense now. I have several little scripts here at work that do just that.

But they are not pretty or stable. Mostly just a HKS (hotkeyset) that swoops up the copied text and activates another prog and pastes and so on .....

If you are interseted I can post an example or 2 if this is actually what you are looking for.

As John mentioned there is no pretty way to do this (that I know of) and that makes it hard to make a one size fits all, they have to be adapted to your specific envirnment.  (what is wrong with my spell chacker?)

cya,

Bill

p.s. come to think of it, NewSciTE in my sig is an example of such a thing....

Edited by billo

Share this post


Link to post
Share on other sites

Thank you for your replies. I'm a little surprised that there is not a function for what I'm trying to do. It doesn't seem like such a reach. Are you and am I understanding this correctly? There is no

WaitClick(3000,1) (hypothetical)

It waits at this line of the script for you to click somewhere, which places the cursor in some text, times out after 3k milliseconds, and either exits or continues (0vs1) the script for example...

Share this post


Link to post
Share on other sites

tsystems,

Creating something like that does not seem too difficult - press {SPACE} to start the function: :)

#include <Constants.au3>
#include <Misc.au3>

Global $hDLL = DllOpen("user32.dll")

HotKeySet("{ESC}", "On_Exit")
HotKeySet("{SPACE}", "_WaitClick")

While 1
    Sleep(10)
WEnd

Func _WaitClick()

    $nBegin = TimerInit()
    Do
        If _IsPressed("01", $hDLL) Then
            Do
                Sleep(10)
            Until Not (_IsPressed("01", $hDLL))
            Return MsgBox($MB_SYSTEMMODAL, "Return", "Mouse button pressed")
        EndIf
    Until TimerDiff($nBegin) > 3000
    MsgBox($MB_SYSTEMMODAL, "Return", "Timeout")

EndFunc

Func On_Exit()
    DllClose($hDLL)
    Exit
EndFunc
How close is that to what you want? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks! I suspect it is close but I can't get it to work. I'll have another look when I have more time.

Share this post


Link to post
Share on other sites

tsystems,

Do you mean you cannot get it to work when incorporated into your script or that you cannot get the actual example I posted to work? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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