How to grab a specific file within a folder

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
theprath
Newbie
Posts: 1
Joined: Wed Oct 20, 2004 7:38 pm
Location: Atlanta, GA

How to grab a specific file within a folder

Post by theprath » Wed Oct 20, 2004 7:50 pm

I am attempting to open and print a file that is housed on our network. I can open the folder and get to a specific file. My problem is the file I want to grab in the macro will vary depending upon the day. For instance, this is what I currently have in the script:

run program>explorer H:\Lockbox\Reports\Lockbox Transmission Report 10-19-2004 06-40am.htm
Wait>1.05
Press enter
Wait>1.05

Very, very straightforward, but if the part of the file "10-19-2004" will change every day and the time after it will vary, what are suggestions on how to cull out just today's date? Do I need to run a getdate somewhere to pull todays date and then pass that variable into what explorer is looking for?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Oct 20, 2004 8:02 pm

Use this to get current date information:
Month>MM
Day>DD
Year>YYYY

Then use those variables in your file name:
run program>explorer H:\Lockbox\Reports\Lockbox Transmission Report %MM%-%DD%-%YYYY% 06-40am.htm
-----------------------------

You will get either 2 or 4 digits for the year, depends on your System settings for Date.
-----------------------------

You might also try getting a GetFileList>H:\Lockbox\Reports\Lockbox Transmission Report %MM%-%DD%-%YYYY% *.htm, Separate the file out, and save the result as a variable for your filename that will provide the real name with the time shown.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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