AHK READS GUI TEXT

Smer4

Известный
424
51
samp UDF - https://blast.hk/threads/20318/
functions:
getDialogText() - Returns the obligation text
RegExMatch - Determines whether a string contains a pattern (regular expression).


find the text from the dialog using getDialogText (),
then using RegExMatch from this text find the value "Įveskite raidę"
and use SendInput to enter the value of this line.
P.s - I apologize if something is wrong this google translator)
 

degrando

Известный
362
127
Example:
AutoHotKey:
#include samp.ahk ; Connecting samp udf
settimer, point, 100

point:
if (isDialogOpen()) { Check whether the dialog is open
if (regexmatch(getDialogText(), "(.*)", out))
msgbox, dialog text: `n%out%
}
return

AutoHotKey:
#include samp.ahk
f2::
if (isDialogOpen()) {
text := getDialogText()
msgbox, %text%
}
else
{
addchatmessage("please open dialog window")
}
return
 

Warklot

Участник
Автор темы
112
3
[CODE = autohotkey]
# IfWinActive GTA: SA: MP

#NoEnv

#include SAMP.ahk

#SingleInstance, force

#UseHook



SetTimer, Update, 50



ChatLog =% A_MyDocuments% \ GTA San Andreas User Files \ SAMP \ chatlog.txt



Update:



lastline: = GetNewLine (ChatLog)





if (isDialogOpen ())

{

if (regexmatch (getDialogText (), "(Įveskite raidę)", out))

sleep 5000

sendchat (var1)



}

return









GetNewLine (filename)



{



static old



static new



if! old



{



FileGetSize, old,% filename%



new: = old



}



while old = new



{



sleep 1; Delay



FileGetSize, new,% filename%



}



old: = new



Loop, read,% filename%



if A_LoopReadLine



{



last: = A_LoopReadLine



}



return last



}





! home :: ExitApp; alt + home = exit

home :: Reload; home = reload



[/ CODE]

i tried this script but i open any gui in game it sends message no matter if it does or doesnt contain that text
 

Smer4

Известный
424
51
[CODE = autohotkey]
# IfWinActive GTA: SA: MP

#NoEnv

#include SAMP.ahk

#SingleInstance, force

#UseHook



SetTimer, Update, 50



ChatLog =% A_MyDocuments% \ GTA San Andreas User Files \ SAMP \ chatlog.txt



Update:



lastline: = GetNewLine (ChatLog)





if (isDialogOpen ())

{

if (regexmatch (getDialogText (), "(Įveskite raidę)", out))

sleep 5000

sendchat (var1)



}

return









GetNewLine (filename)



{



static old



static new



if! old



{



FileGetSize, old,% filename%



new: = old



}



while old = new



{



sleep 1; Delay



FileGetSize, new,% filename%



}



old: = new



Loop, read,% filename%



if A_LoopReadLine



{



last: = A_LoopReadLine



}



return last



}





! home :: ExitApp; alt + home = exit

home :: Reload; home = reload



[/ CODE]

i tried this script but i open any gui in game it sends message no matter if it does or doesnt contain that text

should work, but did not check
AutoHotKey:
#include ../inc/samp.ahk
Loop{
    Sleep, 20
    if(isDialogOpen() && getDialogCaption() == "Patikrinimas")
    {
        RegExMatch( getDialogText(), "Iveskite raide (.*)`n", out)
        if( isDialogOpen() && getDialogCaption() == "Patikrinimas")
          {
            sleep, 200
            SendInput, % out1
            break
           }
    }
}
as soon as the dialog opens, a number is entered and the script turns off.