Sign in to follow this  
Followers 0
Doug

This one should be easy for you

4 posts in this topic

In my script I use the following to remove the focus from the currently on-top window, which I'll call Window A:

MouseMove(500,999,0)

MouseDown("left")

MouseUp("left")

This clicks the mouse button off-screen, which has the desired effect. I've also tried opening an instance of Notepad, which also removes the focus from Window A.

However, the next task doesn't work for me, even though it sounds frighteningly simple. Since the above quoted code moves the mouse pointer off--or to the edge--of the screen, the next thing I want to do is move the mouse pointer to the center of the screen, without clicking anything. All I want to do is move the mouse pointer. However, issuing a new MouseMove command does nothing.

What am I doing wrong? I can't seem to move the mouse pointer without selecting some window. I don't want to select anything.

Thanks,

Doug

Share this post


Link to post
Share on other sites



Doug,

You took the time to write a full size letter here, asking for help.

Your commands of

MouseMove(500,999,0)

MouseDown("left")

MouseUp("left")

May give you the original desired effect, however it is really a mis-use of the commands. You must have found these commands in Help, but there were other mouse commands in that same section. so first, the above commands state

move the mouse to (position)

Hold the mouse click down (left)

Release the hold mouse click down (left)

correctly this would be

MouseMove(500,999,0)

Mouseclick("left") ;>>>>> this does not HOLD the mouse down

But, this may give the desired results now, but for future programming this is considered comming in the back door. the proper way would be more like

get the name of the window with

$WinName = WinActive("") ; put the name of title inside the quotes

then set the state of the window with

WinSetState($WinName, "", @SW_MINIMIZE) ; ; this uses the "handle" $WinName for the title of the previous window we just checked for, this can be used to control this window in the future

so

$WinName = WinActive("") ; title inside quotes

WinSetState($WinName, "", @SW_MINIMIZE)

is the correct way to accomplish your result.... READ ABOUT THESE IN HELP

last, to remove focus from the currently active window and achieve your "desired effect" all you need is this

WinSetState("", "", @SW_MINIMIZE) ; minimizes the "current" active window with no title inside the quotes

READ HELP..............

Good luck


NEWHeader1.png

Share this post


Link to post
Share on other sites

last, to remove focus from the currently active window and achieve your "desired effect" all you need is this

WinSetState("", "", @SW_MINIMIZE) ; minimizes the "current" active window with no title inside the quotes

I wish it were that simple. Unfortunately, I do not want the window to be minimized. The window must retain its current size and continue to be displayed on top, on the Desktop. I've tried all of the WinSetState variations and none of them enable me to simply remove the focus from a window without minimizing it.

Part of my problem might be the fact that my script performs a series of actions when a window becomes active, after which it sleeps until the window becomes active again. This explains my need to make the window become inactive. If I cannot inactivate the window, then the series of actions would never cease. If I minimize the window, the series of actions would cease and the script would sleep, but it would resume when I restored the window. This would prevent me from specifying where on the screen the script should start the actions, which I signal with the cursor position when I click the window, which also makes it active.

However, thanks to your prompting, I just now realize that I can use two WinSetState commands to achieve the functionality I was hoping to find in a single command.

WinSetState("RoboHelp HTML","", @SW_MINIMIZE)

WinSetState("RoboHelp HTML","", @SW_SHOWNOACTIVATE)

These two commands, used consecutively, will remove the focus from a window while effectively leaving it on-screen. However, the momentary minimization and restoration is annoying as h*ll.

More, I just discovered that I can make the mouse move again by changing the Opt("MouseCoordMode") flag. It had been set to 0; setting it to 1 makes the cursor obey the MouseMove command, which was my initial complaint to begin with. Not sure why I have to change the mode, but I set it back at the start of the script so everything is fine. Not pretty, maybe, but effective.

This has the added bonus of letting me remove the 2 WinSetState commands, removing the source of annoyance.

I realize that my programming techniques are a bit improper, but my time is limited so I cut corners where I can. I'm writing little scripts that simplify my job, so the level of quality need not be as high as otherwise.

Thanks for your help!

Share this post


Link to post
Share on other sites

Your welcome

sounds like you found your direction... thats great

enjoy!

8)


NEWHeader1.png

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