Select next row until specific value

Advanced Macro Recorder/Editor.

Moderator: Pulover

Royzer
Posts: 8
Joined: 20 Nov 2013, 12:24

Select next row until specific value

Post by Royzer » 28 Nov 2020, 14:09

I am new to the Macro Creator and could really use some help. I have 99% of it working, but I cannot figure out how to make the macro go to the next row and loop through the code again.

The image below shows what I'm working with. Each row has to be double-clicked and then a series of events occurs (which I already have). There are roughly 400 of these that need to be opened, have code run, then go to the next row and do the same thing until after the last row is done. The last row would be call letters EECT. This has to be done at the end of every month.

I would really appreciate any help I can get.

Thank you.
Attachments
image.png
image.png (7.62 KiB) Viewed 733 times
User avatar
Pulover
Posts: 543
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Select next row until specific value

Post by Pulover » 28 Nov 2020, 15:41

We need to see your code to know what you're doing. What command are you using to select the row? Can't you just Send, {Down} and continue the loop? If this is a standard win32 list you can use a Control, List command to get the data and count the rows to use in the Loop count or check some value to know where to use an if statement with Break to stop it.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Royzer
Posts: 8
Joined: 20 Nov 2013, 12:24

Re: Select next row until specific value

Post by Royzer » 29 Nov 2020, 15:34

Thank you for your reply!

I added the Down keystroke you suggested and now the macro selects the next row. Something I did not realize until I added Down was that even if it moves to the next row, the loop always starts on the top row of the window (see image posted last time) because of the coordinates. If I scroll down the page and run the macro it runs on whichever row is currently at the top of the window. If I can get it to run on whichever row is selected, I think it be what I need.

By the way, name of the windows that open upon double-click is "Air Time Property - " followed by the call letters on that row.


Code: Select all

#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1


Macro1:
WinActivate, Properties ahk_class TfrmStationSearch
Sleep, 333
Sleep, 1000
Click, 28, 146 Left, 2
Sleep, 10
Sleep, 1000
WinActivate, Air Time Property%
Sleep, 333
Sleep, 1000
Click, 106, 216 Left, Down
Sleep, 1000
Sleep, 1000
Click, 229, 274 Left, 2
Sleep, 10
Sleep, 1000
Send, {1}{0}{/}{3}{1}{/}{2}{0}
Sleep, 1000
Send, {Alt Down}{O}{Alt Up}{Down}
Return

User avatar
Pulover
Posts: 543
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Select next row until specific value

Post by Pulover » 29 Nov 2020, 18:25

Isn't there another way to open the row, like pressing enter?
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Royzer
Posts: 8
Joined: 20 Nov 2013, 12:24

Re: Select next row until specific value

Post by Royzer » 30 Nov 2020, 11:04

Enter does not open the row, but your question led me to check the mouse context menu, which has Edit. Edit opens whichever row is highlighted, no matter where it is, so I inserted Send, {Alt Down}{E}{Alt Up} and that works! I now have the loop I was looking for. Thanks so much for responding to my posts, I really appreciate it.

I have one last favor to ask. Would you please help me create an Input Box with a variable for Date that I can use instead of changing the date in the code every month (below)? My goal is to eventually convert the macro to .exe for other users and having a Date input box would be incredibly helpful. Thanks!

Send, {1}{0}{/}{3}{1}{/}{2}{0}
User avatar
Pulover
Posts: 543
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Select next row until specific value

Post by Pulover » 30 Nov 2020, 11:09

Did you notice the search bar on the main window? Try typing InputBox there.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Royzer
Posts: 8
Joined: 20 Nov 2013, 12:24

Re: Select next row until specific value

Post by Royzer » 01 Dec 2020, 10:07

Yes, I had already tried that but didn't know what to put in the fields to accomplish my goal. I will keep trying, though. Thank you.

Edit: I think I have now figured it out. Thanks again.
Post Reply

Return to “Pulovers Macro Creator”