Sign in to follow this  
Followers 0
flat5

Can I select a window by clicking on it?

7 posts in this topic

I want to automate windows that I select by clicking on them. I can't figure out how to do this. The window title text is not known ahead of time.

Is there a way to do this?

Thanks.

Share this post


Link to post
Share on other sites



to get the currently active window's title...

$szTitle = WinGetTitle("")

Lar.

<{POST_SNAPBACK}>

I know about that, but I don't see how it solves the problem. How would I pause and then resume the script such that the WinGetTitle("") would grab the just activated window?

Thanks.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Maybe you should check every second or so what is the active window and if it is one where you want to automate something start the relative code.

E.g.

While 1
   $SZTITLE = WinGetTitle("")
   Select
      Case $SZTITLE = "My first program"
        ;Do what I want on My first program
      Case $SZTITLE = "My second program"
        ;Do what I want on My second program
      Case Else
         Sleep(1000)
   EndSelect
Wend

@Larry... What is the meaning of this strange SZ ? it werent easier just say $Title? :ph34r:

Edited by ezzetabi

Share this post


Link to post
Share on other sites

sz is a common programmers prefix which means the variable contains a string.

Share this post


Link to post
Share on other sites

I admit, I don't have a handle on what you want to do. If you describe it with more detail I may be able to help. I am grasping at straws with my responses.

LAr.

<{POST_SNAPBACK}>

I want to start a script, and have it prompt me for the window I want to automate. I respond by clicking in the window, and it carries on and works with that window.

Share this post


Link to post
Share on other sites

sz is a common programmers prefix which means the variable contains a string.

<{POST_SNAPBACK}>

:(

But... AFAIK all vars in Autoit are Variant and so can keep every kind of data... What is the meaning?

(Sorry for the out-topic, but I am interested) :ph34r:

Share this post


Link to post
Share on other sites

It means exactly what I said. Its a hint to the programmer that the variable with that prefix with be a string. It has nothing to do with the actual implementation of the datatype or that the datatype in theory can hold numbers or whatever. Its along the same lines of why you might name a function after what it does (FileDelete()) instead of some arbitrary name (MonkeyBrains()). Its a descriptive measure to help at-a-glance reading of code.

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