SendMessage and ahk_pid

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
programlearner
Posts: 28
Joined: 10 Apr 2017, 11:31

SendMessage and ahk_pid

30 Apr 2017, 02:20

Hi
I'm trying to use GT Text as an OCR screen-reader.
I downloaded it from here:
http://www.softocr.com/

In the same file - I've added a script that works when I use WinTitle as text:

Code: Select all

SendMessage, 0x111, 33031, 0, , New - GT Text
But not when I use WinTitle as ahk_pid:

Code: Select all

SendMessage, 0x111, 33031, 0, , ahk_pid %GTAppPID%
There's a lot more I want to do, but can't move on until this is working.

Could someone please explain why?

This works:

Code: Select all

#SingleInstance force
#Persistent
SetBatchLines -1
#NoEnv
SetWorkingDir %A_ScriptDir%
DetectHiddenWindows On 
SetTitleMatchMode, 2
clipboard =
;ahk_class Afx:00400000:b:00010003:00000006:007D04BF

Run, GT.exe, %A_ScriptDir%, Hide, GTAppPID
;Hide doesn't work - can't work out why
WinWait, New - GT Text
WinHide, New - GT Text

Sleep, 100
;Click capture from screen button - and wait for response
SendMessage, 0x111, 33031, 0, , New - GT Text
ClipWait, 60

;Close the application
PostMessage, 0x112, 0xF060,,, New - GT Text
ExitApp

This Does not work:

Code: Select all

#SingleInstance force
#Persistent
SetBatchLines -1
#NoEnv
SetWorkingDir %A_ScriptDir%
DetectHiddenWindows On 
SetTitleMatchMode, 2
clipboard =
;ahk_class Afx:00400000:b:00010003:00000006:007D04BF

Run, GT.exe, %A_ScriptDir%, Hide, GTAppPID
;Hide doesn't work - can't work out why
WinWait, ahk_pid %GTAppPID%
WinHide, ahk_pid %GTAppPID%

Sleep, 100
;Click capture from screen button - and wait for response
SendMessage, 0x111, 33031, 0, , ahk_pid %GTAppPID%
ClipWait, 60

;Close the application
PostMessage, 0x112, 0xF060,,, ahk_pid %GTAppPID%
ExitApp
As always - thanks for the help...I'm loving AHK
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: SendMessage and ahk_pid

30 Jul 2021, 21:06

bump

can you use SendMessage with a process-id? or does it have to be a hwnd?

lexikos gives some info here:
http://autohotkey.com/board/topic/46251-onmessage-0x4a-is-ignored-when-a-tooltip-is-displayed/?p=287950


Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: dipahk, Google [Bot], haomingchen1998 and 248 guests