Search Loop on a String in the Screen

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rayanwin
Posts: 2
Joined: 16 Aug 2017, 15:18

Search Loop on a String in the Screen

16 Aug 2017, 16:05

Hello guys. I'm very newbie in AutoHotKey so far. I've just downloaded and begin to use it. So, i'm trying to "update" a MACRO that has beeing used by my company in years, and the MACRO is a script on the Excel. The MACRO has to comunicate and do some simple tasks in other program, simple tasks like "press F4, type X", and that kind stuff. Easy, and i've already done that script. The problem is that in some point the MACRO has to press F4 till the screen changes, that can take like 1-5 minutes. In the old MACRO, the Excel comunicate with the screen by coordinates like cells of the sheet, but using numbers that the program uses to coordenate himself (like this image http://imgur.com/a/Wy9CF)Note the coodinate on the bottom. The code on the Excel copy a string on that screen and use that information to create a condition to loop or not (like in this part of the code http://imgur.com/a/GifDN). So, i need to do the same in the AutoHotKey, i had already done that by using a script like this one:

" match_text1=fone
clipboard =
send {Left 11}
send {Shift down}
send {Left 4}
send {Shift up}
Send ^c
var1=%clipboard% "

That works, but the problem is that take a long time in every loop, and the process i have to do cant be delayed, like one F4/0,5 secunds. When the F4 is pressed, the cursor is in a different place that the first try, thats why all that "arrows move". So i need something like the MACRO on the Excel, something that can be coordenate by the "cells" on the program. Someting that can put the cursor on a specific place on the program screen, like the "Set_Cursor" function of the Excel.

I was wondering to use the Mouse coordenate native function, but this MACRO will be used in several different computers, with different screen resolution.

He is the WindowSpy info about the program:http://imgur.com/a/mYCMs


Hope you can help me guys. Ty

Image
Image
Image
Attachments
STC.JPG
Program
STC.JPG (141.6 KiB) Viewed 227 times
Spy.png
WindowSpy
Spy.png (13.08 KiB) Viewed 390 times
MACRO.JPG
MACRO Excel
MACRO.JPG (183.33 KiB) Viewed 227 times
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Search Loop on a String in the Screen

16 Aug 2017, 23:23

I'm unfamiliar with VBA to understand exactly what is going on, but maybe someone who knows it can have a better grasp of what you're asking.

Are you essentially asking for a way to identify the coordinates that you put a red rectangle around in your first image? That could be possible using ControlGetText or maybe WinGetText, if it is a control that AHK can interact with.

I'm curious if the target program can be interfaced through COM. I know AHK can interface Excel itself with COM (see tutorials section on the forums for examples on that, but I don't know if that's what you want; could be).
rayanwin
Posts: 2
Joined: 16 Aug 2017, 15:18

Re: Search Loop on a String in the Screen

17 Aug 2017, 06:38

Exaskryz wrote:I'm unfamiliar with VBA to understand exactly what is going on, but maybe someone who knows it can have a better grasp of what you're asking.

Are you essentially asking for a way to identify the coordinates that you put a red rectangle around in your first image? That could be possible using ControlGetText or maybe WinGetText, if it is a control that AHK can interact with.

I'm curious if the target program can be interfaced through COM. I know AHK can interface Excel itself with COM (see tutorials section on the forums for examples on that, but I don't know if that's what you want; could be).
In the VBA the script says "move the cursor to the coordinates x and y, them copy the string beggining in x,y till x2,y2. Them, compare to a pre define string on the code". What i really need is move the cursor directly to some specific coordinate so i can "copy" a string to compare with a variable and them make a condition to loop. Or something else that tells the AutoHotKey that the screen "changes" and stop the loop.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Search Loop on a String in the Screen

17 Aug 2017, 12:07

Well the cursor can be moved by MouseMove, if the coordinate is always the same, but I assume it's not if you moved to doing arrow key moves.

Uhm, actually, try changing to SendInput instead of Send. See if that gives you the speed you want. Otherwise, I'm at a loss to how better to interact with the program being unfamiliar with it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Descolada, maxkill, RandomBoy, ShatterCoder and 304 guests