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
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:
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.