I have an issue trying to copy and rename a few files. I'm trying to copy and rename a few thousand Tif file into a new folder and rename them.
Let>y=00000001
Repeat>x
CopyFile>%Path%\001%RollNumber%%x%.tif,C:\WM\%RollNumber%\%y%\0\00\%ImageName%.tif
Let>y=y+1
Until>x=1000
This is a sample code and it works fine with the first image and it renames 00000001.tif.
But when I get to the second image it just name it 2.tif.
I know that the problem come when I increment the y by 1, so how can I get it to format with all of the zero infront of the images name? I want the images to be named:
00000001.tif
00000002.tif
00000003.tif
00000004.tif etc...
Any help here would be greatly appreciated. Thanks in advance,
-daniel
Image File Renaming
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
2 is a number. 0000002 is a string. You just need to convert from the loop counter to a string. You can do this:
VBSTART
VBEND
//e.g. with x = 2
Let>x=2
VBEVal>Right("00000000" & %x%,8),strX
VBSTART
VBEND
//e.g. with x = 2
Let>x=2
VBEVal>Right("00000000" & %x%,8),strX
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?