I do not need the whole mouse moving and position setting anymore. Instead, i want a function i can start by pressing f4 for example that presses enter itself in a 5 second interval until the phrase "Magic Find increased by %: x" is found or a value higher than x.
Id appreciate any help i could get here!
Code: Select all
User
#include Lib\OCR.ahk
OCRenabled := true ; true = enable highlighting, if MF value is greater or equal to "TargetMF". false = no highlighting
TargetMF := 60
; --------------------------------------------------------------
Size := 20, Color := "Red", ToolTipShow:= true
coordMode('Mouse', 'screen')
coordMode('ToolTip', 'screen')
myGui := Gui()
myGui.Opt("-Caption +ToolWindow +AlwaysOnTop +LastFound")
myGui.BackColor := Color
GuiHwnd := WinExist()
DetectHiddenWindows(true)
WinSetTransparent(100, "ahk_id " GuiHwnd)
WinSetRegion("0-0 W" Size " H" Size " E", "ahk_id " GuiHwnd)
WinSetExStyle(32, "ahk_id " GuiHwnd)
myGui.Show("w" . Size . " h" . Size . " hide")
btnPosX := "", btnPosY := ""
Send("{F3}")
Return
F1::
{
MouseGetPos(&MouseX, &MouseY)
global btnPosX := Round(MouseX - Size/2)
global btnPosY := Round(MouseY - Size/2)
myGui.Show("x" . btnPosX . " y" . btnPosY . " NA")
Return
}
F2::
{
global btnPosX := ""
global btnPosY := ""
myGui.Hide()
Return
}
F3::
{
if (ToolTipShow == true) {
if (OCRenabled) {
ToolText := "OCR ENABLED; MF target: " TargetMF "%`n"
} else {
ToolText := "OCR disabled`n"
}
ToolTip(ToolText "F1 - Set click position`nF2 - Clear position`nF3 - Show/Hide this tooltip`nCtrl + Space - Click @pos and move mouse back`nCtrl + Esc - Exit Script", A_ScreenWidth-100, 30)
} else {
ToolTip()
}
global ToolTipShow := !ToolTipShow
Return
}
^Space::
{
if (btnPosX != "" and btnPosY != "") {
MouseGetPos(&MouseX, &MouseY)
MouseMove(btnPosX, btnPosY)
sleep(100)
MouseClick "left"
sleep(250)
MouseMove(MouseX, MouseY)
if (OCRenabled) {
sleep(100)
; OCR
result := OCR.FromDesktop()
For Index, Value In result.Lines
if InStr(Value.Text, "MagicFind") or InStr(Value.Text, "Magic Find") {
; MsgBox "Value for MF is: " SubStr(result.Lines[Index].Text, 28, 4)
if (SubStr(result.Lines[Index].Text, 28, 4) >= TargetMF) {
result.Highlight(result.Lines[Index], 1500)
}
break
}
}
}
Return
}
^Esc::
{
ExitApp
}
[Mod action: Topic moved to the "Gaming" section.]