If Visible Text in window - do this Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AndyRal123
Posts: 21
Joined: 10 Oct 2020, 12:32

If Visible Text in window - do this

Post by AndyRal123 » 18 May 2022, 07:07

Hello,


Thank You in advance for any help and for this autohotkey community forum.
I tried many ways, have read docs and forum threads, but cannot make it work.

I want to make script, in which:
- if there is visible text 'alamypanel' in window:
▶ then make ''o'' execute :: MsgBox, alamypanel found


The visible text is the only thing changing between active windows in this program, so I want something like #ifwinactive but instead of checking the #wintitle to make it check if this specific 'alamypanel' text is visible in window.

I tried, but did not work:

Code: Select all

DetectHiddenText, Off

WinGetTitle, WinTitle,Alamy - User Bar
WinGetText, WinText,alamypanel
o::    
MsgBox, MsgBox, alamypanel found
also tried, but did not work:

Code: Select all

WinGetTitle, WinTitle, Alamy - User Bar
WinGetText, visibleTextString, alamypanel
o::    
MsgBox, alamypanel found


Is there a way to make the visible text detection just like with #ifwinactive?

Much much gratitude for any help with script, because I cannot find the proper line for that.
Thank You,
Andy :) ;) ;)

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: If Visible Text in window - do this

Post by mikeyww » 18 May 2022, 07:19

Code: Select all

winTitle = Alamy - User Bar

#If WinExist(winTitle) && visibleText(winTitle)
o::MsgBox, 64, Found, alamy found
#If

visibleText(winTitle) {
 DetectHiddenText, Off
 WinGetText, text, %winTitle%
 Return StrLen(text)
}

AndyRal123
Posts: 21
Joined: 10 Oct 2020, 12:32

Re: If Visible Text in window - do this

Post by AndyRal123 » 18 May 2022, 16:57

mikeyww wrote:
18 May 2022, 07:19

Code: Select all

winTitle = Alamy - User Bar

#If WinExist(winTitle) && visibleText(winTitle)
o::MsgBox, 64, Found, alamy found
#If

visibleText(winTitle) {
 DetectHiddenText, Off
 WinGetText, text, %winTitle%
 Return StrLen(text)
}
Hello again Mikey @mikeyww :)

Thank You very much for response, another time You are helping me out. 👋🏻👋🏻👋🏻:)
Well I tried these lines, changed them in many ways, but I can not see anywhere here, that the code recognizes if text 'alamypanel' is visible in the window.
For me it looks like the code treats winTitle as a visible text, because nowhere it mentions detection of visible text 'alamypanel'.
Therefore, it works always when it sees that window title.

Whereas I want to execute shortcut, only when text 'alamypanel' is visible on the screen.
Is there something to correct here? :roll:


Thank You very much for Your help and time.
All good and greetings,
Andy :)

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: If Visible Text in window - do this  Topic is solved

Post by mikeyww » 18 May 2022, 19:22

Same idea.

Code: Select all

winTitle = Alamy - User Bar

#If WinExist(winTitle) && visibleText(winTitle, "alamypanel")
o::MsgBox, 64, Found, alamy found
#If

visibleText(winTitle, find) {
 DetectHiddenText, Off
 WinGetText, text, %winTitle%
 Return Instr(text, find)
}

AndyRal123
Posts: 21
Joined: 10 Oct 2020, 12:32

Re: If Visible Text in window - do this

Post by AndyRal123 » 20 May 2022, 19:14

mikeyww wrote:
18 May 2022, 19:22
Same idea.

Code: Select all

winTitle = Alamy - User Bar

#If WinExist(winTitle) && visibleText(winTitle, "alamypanel")
o::MsgBox, 64, Found, alamy found
#If

visibleText(winTitle, find) {
 DetectHiddenText, Off
 WinGetText, text, %winTitle%
 Return Instr(text, find)
}

@mikeyww thank You very much :D :thumbup:
This one works for if visibletext :thumbup: :thumbup:

Another time You ale helping a lot, thank You! :wave:

Post Reply

Return to “Ask for Help (v1)”