Folder names

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
kwest
Newbie
Posts: 1
Joined: Tue Apr 17, 2012 10:25 am

Folder names

Post by kwest » Tue Apr 17, 2012 10:27 am

I’ve just started using this software and am already very impressed it’s so much superior to other macro programs out there. Right now I’m trying to complete a project which I believe should be pretty easy but I can’t really seem to get it.

What I need to do is go to a directory filed with folders that change names constantly. I need to one by one go into each folder and open a text file named “textâ€Â

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

Post by Marcus Tettmar » Tue Apr 17, 2012 11:48 am

Yes. Use GetFileList with GFL_TYPE set to 1 to get a list of directory names in a folder:

Let>GFL_TYPE=1
GetFileList>c:\folder\*.*,folder_list

Then loop through the list of returned folder names and for each construct the path to the text file contained within. And then you can load it up in your software:

Code: Select all

Let>GFL_TYPE=1
GetFileList>c:\c b\*.*,folder_list

//now loop through the folder list for files within them
Separate>folder_list,;,folders
If>folders_count>0
  Let>fldr=0
  Repeat>fldr
    Let>fldr=fldr+1
    Let>this_folder=folders_%fldr%
    
    //get the path to the text.txt file we want
    Let>text_file=%this_folder%\text.txt
    
    //do what you want with the file here (pass on command line,
    //or send keystrokes to the software to file/open it ... or whatever ...)
    
  Until>fldr=folders_count
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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