Calculation Based On A Variable

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Calculation Based On A Variable

Post by Dexter1 » Fri Jun 30, 2006 6:28 pm

I want to copy a file from one directory to another. The naming convention for both directories is always the same and the name of the file is always the same. The folders are numbered and I want to enter the current week number, then copy a file to that week's folder from the previous week's folder.

Code: Select all

input>WeekNumber,Enter Week Number
let>LastWeek=WeekNumber-1
copyfile>\\Location\WK%LastWeek%_2006\File.ppt,\\rnodata01Location\WK%WeekNumber%_2006\File.ppt
So if I enter 26 for the week number, I want \\Location\Week25_2006\File.ppt copied to \\Location\Week26_2006\File.ppt.

I feel like I'm missing something easy here, but I can't seem to get it together.
Thanks,
Josh

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Jun 30, 2006 6:43 pm

try this:

input>WeekNumber,Enter Week Number
let>LastWeek=WeekNumber-1
createdir>\\Location\WK%WeekNumber%_2006

then you can use your copy statement....

[/code]

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Fri Jun 30, 2006 6:49 pm

Thanks, but the directory will have been created and filled with files before I run this macro.

I found my error, though: I was missing a letter in my Location.

Thanks for your help!
Thanks,
Josh

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Jun 30, 2006 7:35 pm

Not knowing that your directory was already created, it appeared you were trying to copy a file to a directory that did not exist.

glad you found the error.

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