Вопросы по AHK-скриптингу

клешь рояль

Известный
1,255
551
AutoHotKey:
#SingleInstance force
#Persistent
#UseHook

SetTimer, Update, 50


ChatLog = C:\Users\Ivan\AppData\Roaming\.vimeworld\minigames\logs\latest.txt

Update:
lastline := GetNewLine(ChatLog)
if(RegExMatch(lastline, "\[([0-9]*):([0-9]*):[0-9]*\] \[Client thread\/INFO\]: \[CHAT\] Королевский зомби был повержен!.*", var))
{
    hour := var1
    minute := var2
   
    minute += 20
    if(minute > 59)
    {
        hour++
        minute := minute-60
        hour := format("{:02d}", hour)
        minute := format("{:02d}", minute)
    }
    msgbox, Founded time in chatlog: %var1%:%var2%`nNew time: %hour%:%minute%
}
return


GetNewLine(filename)
{
static old
static new
if !old
    {
        FileGetSize, old, %filename%
        new := old
    }
while old = new
    {
        sleep 100 ;задержка
        FileGetSize, new, %filename%
    }
old := new
Loop, read, %filename%
if A_LoopReadLine
    {
        last := A_LoopReadLine
    }
return last
}

!end::ExitApp
end::Reload

Обязательно проверь работоспособность.
не работает, у меня нечего не отображается, даже msgbox
 

meowprd

Тот самый Котовский
Проверенный
1,280
712

клешь рояль

Известный
1,255
551
Строка в чате то хоть есть?
Проверка как бы на строку идет.

38876
38877

пробовал и с разными строками и с 1
 

клешь рояль

Известный
1,255
551
взял основу от сюда https://blast.hk/threads/31713/
и чуть переделал под майн, но не работает. Должен показывать msg box но нечего не происходит.
AutoHotKey:
ChatLog = C:\Users\Ivan\AppData\Roaming\.vimeworld\minigames\logs\latest.txt

loop
{
lastline := GetNewLine(ChatLog)
var = беру
RegExMatch(var, "беру", var)
MsgBox % var1

If expression !=
{
   MsgBox % var1
}
}

GetNewLine(filename)
{
static old
static new
if !old
    {
        FileGetSize, old, %filename%
        new := old
    }
while old = new
    {
        sleep 100 ;задержка
        FileGetSize, new, %filename%
    }
old := new
Loop, read, %filename%
if A_LoopReadLine
    {
        last := A_LoopReadLine
    }
return last
}

!end::ExitApp
end::Reload
ап
код который сделали но не работает
AutoHotKey:
#SingleInstance force
#Persistent
#UseHook

SetTimer, Update, 50


ChatLog = C:\Users\Ivan\AppData\Roaming\.vimeworld\minigames\logs\latest.txt

Update:
lastline := GetNewLine(ChatLog)
if(RegExMatch(lastline, "\[([0-9]*):([0-9]*):[0-9]*\] \[Client thread\/INFO\]: \[CHAT\] Королевский зомби был повержен!.*", var))
{
    hour := var1
    minute := var2
   
    minute += 20
    if(minute > 59)
    {
        hour++
        minute := minute-60
        hour := format("{:02d}", hour)
        minute := format("{:02d}", minute)
    }
    msgbox, Founded time in chatlog: %var1%:%var2%`nNew time: %hour%:%minute%
}
return


GetNewLine(filename)
{
static old
static new
if !old
    {
        FileGetSize, old, %filename%
        new := old
    }
while old = new
    {
        sleep 100 ;задержка
        FileGetSize, new, %filename%
    }
old := new
Loop, read, %filename%
if A_LoopReadLine
    {
        last := A_LoopReadLine
    }
return last
}

!end::ExitApp
end::Reload

Обязательно проверь работоспособность.
 

NOOBPAndA

Участник
101
12
Как сделат что бы скрит определенное время записывал все кажатые клавиши в буфер обмена?
 

Warklot123

Новичок
9
0
Hello, maybe someone could help me with chatlog and responde. i need script that reads GTA:SA:MP chatlog and if it finds like word "bitch" the script sends the command /mute
 

CaJlaT

Овощ
Модератор
2,806
2,604
Hello, maybe someone could help me with chatlog and responde. i need script that reads GTA:SA:MP chatlog and if it finds like word "bitch" the script sends the command /mute
Код:
#IfWinActive GTA:SA:MP
#NoEnv
#SingleInstance, force
#include SAMP.ahk


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

while(true)
{
    FileRead, clog, % cl
    if (RegExMatch(clog, "bitch"))
    {
        FileDelete, % cl
        SendChat("/mute")
    }
Return
}
 

CaJlaT

Овощ
Модератор
2,806
2,604
[QUOTE = "_ Senya_, post: 394959, member: 102899"]
Код:
 #IfWinActive GTA: SA: MP
#NoEnv
#SingleInstance, force
#include SAMP.ahk


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

while (true)
{
    FileRead, clog,% cl
    if (RegExMatch (clog, "bitch"))
    {
        FileDelete,% cl
        SendChat ("/ mute")
    }
Return
} [/ CODE]
[/ QUOTE]
[ATTACH type="full" alt="39075"]39075[/ATTACH]
This is the error of your Samp-udf, try this
 

Вложения

  • SAMP.ahk
    222.7 KB · Просмотры: 3