Sign in to follow this  
Followers 0
daldous

Quick newb question

4 posts in this topic

Keep in mind that I'm a total noob at this stuff :whistle:

I want to focus on a window, click a button, and then right away focus back on the last window.

Now, I know the firs two bits:

WinActivate(...

ControlClick(...

Now all I want to figure out is the title of the window that is currently focused (before all of this).

Ie. Firefox is open, and Calculator is open.

Firefox has focus.

Focus on Calculator, calculate 5x5,

Focus back on Firefox

The Middle part I know how to do, and the last. The first part - figuring out what is the currently focused window, is my question.

Now, remember - you were a noob yourself once :)

Share this post


Link to post
Share on other sites



Now, I know the firs two bits:

WinActivate(...

ControlClick(...

ControlClick does not need an active window as it directly works with the Control.

This example ControlClicks Calculator, but Calculator is not active.

Run('Calc')
WinWait('Calc')
Run('Notepad')
WinWait('Untitled')
Sleep(1000); just to see active notepad
ControlClick('Calc', '', '5')
ControlClick('Calc', '', '*')
ControlClick('Calc', '', '5')
ControlClick('Calc', '', '=')
WinActivate('Untitled')
WinWaitActive('Untitled')
Send('Some text')

Mouse* actions and Send require active windows so use WinActivate and WinWaitActive before using them.

:whistle:

Share this post


Link to post
Share on other sites

Haha, you guys are bloody awesome. Thanks so much :whistle:

WinGetTitle("") works like a charm and ControlClick indeed doesn't need window focus to work.

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