Reading text within an app
Posted: 13 Apr 2024, 13:11
Hello! A pretty new programmer trying to do something somewhat simple. I have been trying to get a script that can read text on screen within an app. Upon detection of that specific text I wanted it to pop up with a MsgBox letting me know that the specific text has been sent! I’ve tried everything i could but to no avail.
(I hope this code pastes correctly since i’m on mobile)
——————————————————————————————————————————
——————————————————————————————————————————
Please don't be afraid to tell me that this is complete gibberish if you know any help for the solution![Laughing :lol:](./images/smilies/icon_lol.gif)
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2.]
(I hope this code pastes correctly since i’m on mobile)
——————————————————————————————————————————
Code: Select all
Loop { ; Start Loop
if (WinActive("ahk_exe *program*.exe")) ; program is open
{
WinGetText, text, ahk_exe program.exe ; Get Text from program if open
IfInString, text, "Warning!" ; Check if text is Warning!
{
MsgBox "Warning DETECTED!" ; If so, stop app
ExitApp ; Stops app
Please don't be afraid to tell me that this is complete gibberish if you know any help for the solution
![Laughing :lol:](./images/smilies/icon_lol.gif)
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2.]