Variables and Msgbox help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Sneakysnail
Posts: 44
Joined: 12 Jun 2020, 05:59

Variables and Msgbox help

Post by Sneakysnail » 08 Dec 2022, 20:06

Good day to tall.

I need help with my script. I want the variables that have been detected only, to show up in the one message box that I have. I am not a pro and this is a hobby of mine.
I am using another script called FindText to help me build this script of mine. The script is incomplete.
Any help will be greatly appreciated.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#Singleinstance, force

F2::Pause
F3::Exitapp

F1::

Loop
{
Var1:= "Test 1" ;<--------------- Only want the variables to show up that have been detected.
Var2:= "Test 2"


t1:=A_TickCount, X:=Y:=""

Text:="|<Test 1>*165$16.kDn1UwA0lU360AM0lU360AM3lUD60wA3kMD0zc"
Text:="|<Test 2>*169$166.k000300000003k0000w0000001U30000A0M00000M0000601U000060A0000k0000001U0000M0000000M0k00030000000600001U0000001U30000A0000000M00006000000060A7k7UklVj0xU7sS1g1yP63kPkDMTklVVX66766C0666701VkMFVlVXX36366AkMMMkM0MMMM0661X266A68AMAkAm1VVX1U1X0lU0MM68AMMkMklUn0ns666A606A3601VUNzlVW1Xn63A3DUMMMkM0MkAM0661W066M63wMAkAn1VVX1U1X0lU0MM6A0MMUM3lUlVX6666A60666601VUMk1VX3UD3666AAMMMNs0MMMM0661VV66AS8w7k7UkNVVUtU1US1U0MM63sMMSMS00000000006000000000000000000000000000k000000000000000000000000013000000000000000000000000007s00000000000000002"

 if (ok:=FindText(1069, 424, 1511, 852, 0, 0, Text))
 {
   CoordMode, Mouse
   X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
   ; Click, %X%, %Y%
   Msgbox, 4, TF, The following information has been found:`n%Var1%    ;<----------- Only show variables that have been detected here.
 }



; #Include <FindText>

 t1:=A_TickCount, X:=Y:=""

Text:="|<20>*162$25.DU1wTw1zDT1vk3Vss1ksC0sQ70QC3USD1kS70sS3UQS1sCS0Q7S0C3i071z01lrzUzvzkDs001kU"
Text.="|<19>*165$24.603sz07wz0DS70QD70Q770Q770Q770Q770QD70Dz707z701b7007700C700C70Tw70Ts007UU"
Text.="|<21>*171$21.Dk1zz0zxw7s3U70Q0s3U70Q0s7U71s0sS077U0ts07S00vU07w00zzU7zw0vz02U"
Text.="|<22>*161$24.DU3szsDyxwDT0Q070Q070Q070Q070w0D1s0S3k0w7U1sD03kS07UQ070w0D0zwDzzwDzU"
Text.="|<23>*171$24.Dk7wzsDyxwDT0Q070Q070Q070Q0C0w3w1s3w3k1y7U07D007S007Q007w00DzwDzzwDyTs3sU"
Text.="|<18>*165$24.603sz07yz0DT70C770C770C670DC707w707w70Dy70CT70Q770Q770Q770S770Dz707y001sU"
Text.="|<24>*163$25.Dk06Tw07DT07U3U7k1k3s0s3w0Q3a0S3X0S1lUS1kkS1zyS0zzS0Tzi007D003bzU1nzk0t"
Text.="|<26>*159$25.DU0zTw1ziT1sk3Us01ks00sQ00QCw0S7zUS3zkS1kQS0sCS0Q7S0C3i071z01kzzUzvzkDs001kU"
Text.="|<25>*163$24.Dk7zzs7zxw7z0Q700Q700Q700Q700w7s1s7y3k0T7U07D007S007Q007w00Dzw7yzw7w007kU"
Text.="|<27>*163$26.Dk7zjy3zzrkzz0Q03U700s1k0Q0Q0C0D03U7U1k3k0M1s0C0w070S01k700w3k0C0zw3UDz1s2"

 if (ok:=FindText(1079, 382, 1511, 514, 0, 0, Text))
 {
   CoordMode, Mouse
   X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Sleep, 500
   Send, {Up}
   Sleep, 500
 }
 Else
 {
 Sleep, 500
 Send, {Down}
 Sleep, 500
 }

}

Return

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

Re: Variables and Msgbox help

Post by mikeyww » 08 Dec 2022, 20:55

Some tips:

1. Shorten your script so that you can get a small piece of it working first.
2. Remove the loop during your testing, so that you can get one iteration working.
3. Test for one string. If successful, append something to a variable.
4. Repeat #3 once.
5. Use MsgBox to show the variable that you "built".
6. Put CoordMode before the commands that refer to coordinates.
7. If you get stuck, display the values of your variables, functions, & conditional statements.
8. After you get these steps working, you can add more searches or loop.

Post Reply

Return to “Ask for Help (v1)”