MousClick location not as expected Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

MousClick location not as expected

22 Jan 2021, 08:45

Dear helpers,
To send keystrokes to the application FrameMaker (version > 8) I need to add a mouseclick after the window activation to be able to input anything into that application.
In a script which shall send keystrokes I have these statements

Code: Select all

  If WinExist("ahk_exe FrameMaker.exe") 
    WinActivate, ahk_exe FrameMaker.exe 
    WinGetPos, wX, wY, wWidth, wHeight, ahk_exe FrameMaker.exe
MsgBox, %wX%`, %wY%`, %wWidth%`, %wHeight%
  Sleep, 500
     MouseClick, Left, Width-350, 10, 1, 30 ; , R   ; left to the top right icons, 1 click, fast speed
  SendKeyStrokes("{ESC}"id)
  SendKeyStrokes("Where are we?")
  exitapp
The second line here really activates the desired window, but I can not yet enter anything into the application
After MousClick I can enter, but this depends on the current window set-up on my screen.
The Mouse does not go to the coordinates -350, 30, but somwhere in the target window:
Image
Because this is not where I expected it, I checked the results of WinGetPos (after having verified the statement is according to Help:
; WinGetPos [, X, Y, Width, Height, WinTitle, WinText, ExcludeTitle, ExcludeText]
MsgBox, %wX%`, %wY%`, %wWidth%`, %wHeight% report these values: 1787, 882, 49, 449 which are not at all what I expect (Window Spy): 5, 10, 1835, 1350.
As a result, the keystrokes are sent to the nirwana and not into the document.
Klaus Daube, Zürich, CH
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: MousClick location not as expected

22 Jan 2021, 08:59

Seemingly the vertical 'toolbar' window right at the bottom of the FrameMaker window is active.
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: MousClick location not as expected  Topic is solved

22 Jan 2021, 09:14

P.S.: You might try to specify the class of the main window.
User avatar
mikeyww
Posts: 26862
Joined: 09 Sep 2014, 18:38

Re: MousClick location not as expected

22 Jan 2021, 09:15

Change wWidth to Width.

Code: Select all

If !WinExist("ahk_exe FrameMaker.exe") {
 MsgBox, 48, Error, FrameMaker window was not found. Exiting.
 ExitApp
} Else WinActivate
WinGetPos,,, width
MouseClick,, width - 350, 10,, 30
SendInput {Esc}%id%Where are we?
ExitApp
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Re: MousClick location not as expected

22 Jan 2021, 11:16

just me wrote:
22 Jan 2021, 08:59
Seemingly the vertical 'toolbar' window right at the bottom of the FrameMaker window is active.
After careful inspection I see that you are right!

And yes,
If !WinExist("ahk_class FrameFamily15.MdiFrame") {
Did the trick.
I end up with a variable ...
fmVersion := "15" ; 10 … 16
If !WinExist("ahk_class FrameFamily" . fmVersion . ".MdiFrame") {

Thank you a lot - especially in these harshe times!
Klaus Daube, Zürich, CH
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: MousClick location not as expected

22 Jan 2021, 11:36

You're welcome, stay healthy!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Freddie, gongnl, mmflume, ShatterCoder and 92 guests