Looping through an array?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Looping through an array?

Post by Tourless » Mon Jun 19, 2017 5:41 pm

Hi Folks,

Part of the process I'm trying to automate is repeating an import procedure for QuickBooks files. The import procedure is a simple series of ALT+ combinations, focus, and waiting states. Where I hit a wall is actually selecting the files to be imported. Now early in my script I use GetFileList and can return the number and name of the files to a message box, so is there a way I can use that to tell my loop that after the import file dialog box opens to sort by name, then starting with the first file, select it and click the open button... finishing the first iteration of the loop. Then again, sort by name, then select the second file and click the open button, etc., and so on until it completes processing all the files based of the GetFileList?

i know what I want to do, I just can't do it! :( lol

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Looping through an array?

Post by Marcus Tettmar » Wed Jun 21, 2017 9:09 am

Hi,

The example in the help file for GetFileList shows how you would explode the list to an array and then loop through it. You can sort the array first using the ArraySort function.

https://www.mjtnet.com/manual/getfilelist.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Re: Looping through an array?

Post by Tourless » Wed Jun 28, 2017 8:42 pm

Perfect information, thank you so much!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts