I need help with this script
Moderators: Dorian (MJT support), JRL
I need help with this script
Let>PuzzleCode=pr
Let>directory=c:\test
GetFileList>%directory%\*.*,files
Separate>files,;,oldname
MidStr>%oldname%,3,8,value1
MidStr>%oldname%,3,2,value2
MidStr>%oldname%,6,2,value3
Let>newname=%PuzzleCode%%value1%%PuzzleCode%%value2%%value3%puzzle.eps
CopyFile>oldname,newname
Let>directory=c:\test
GetFileList>%directory%\*.*,files
Separate>files,;,oldname
MidStr>%oldname%,3,8,value1
MidStr>%oldname%,3,2,value2
MidStr>%oldname%,6,2,value3
Let>newname=%PuzzleCode%%value1%%PuzzleCode%%value2%%value3%puzzle.eps
CopyFile>oldname,newname
Last edited by timle on Thu Sep 20, 2007 6:15 pm, edited 1 time in total.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Separate creates an array. Your example splits the list "files" into array "oldname". So you end up with oldname_1, oldname_2 .... oldname_count
So youre MidStr commands won't work. oldname is not a variable. I expect you actually intend to operate on each element of the array inside a loop?
Something like:
But I'm guessing because I'm not really sure what you are trying to do ...
So youre MidStr commands won't work. oldname is not a variable. I expect you actually intend to operate on each element of the array inside a loop?
Something like:
Code: Select all
Let>PuzzleCode=pr
Let>directory=c:\test
GetFileList>%directory%\*.*,files
Separate>files,;,oldname
Let>k=1
Repeat>k
Let>thisfile=oldname_%k%
MidStr>%thisfile%,3,8,value1
MidStr>%thisfile%,3,2,value2
MidStr>%thisfile%,6,2,value3
Let>newname=%PuzzleCode%%value1%%PuzzleCode%%value2%%value3%puzzle.eps
CopyFile>oldname,newname
Let>k=k+1
Until>k>oldname_count
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?
Script seems to do nothing ..help
The script did not do any thing.
I would like to change the old name to the new name, but it did not work
I must have over look something...
====================================
//objective
//file name is: cm09_16___cmNYTpuz
//need to change to: pr09_16___pr0916puzzle
Let>PuzzleCode=pr
Let>directory=c:\comictest
GetFileList>%directory\%*.*,files
Separate>files,;,oldname
Let>k=1
Repeat>k
Let>thisfile=oldname_%k%
MidStr>%thisfile%,3,8,value1
MidStr>%thisfile%,3,2,value2
MidStr>%thisfile%,6,2,value3
Let>newname=%PuzzleCode%%value1%%PuzzleCode%%value2%%value3%puzzle.eps
CopyFile>oldname,newname
Let>k=k+1
Until>k>oldname_count
I would like to change the old name to the new name, but it did not work
I must have over look something...
====================================
//objective
//file name is: cm09_16___cmNYTpuz
//need to change to: pr09_16___pr0916puzzle
Let>PuzzleCode=pr
Let>directory=c:\comictest
GetFileList>%directory\%*.*,files
Separate>files,;,oldname
Let>k=1
Repeat>k
Let>thisfile=oldname_%k%
MidStr>%thisfile%,3,8,value1
MidStr>%thisfile%,3,2,value2
MidStr>%thisfile%,6,2,value3
Let>newname=%PuzzleCode%%value1%%PuzzleCode%%value2%%value3%puzzle.eps
CopyFile>oldname,newname
Let>k=k+1
Until>k>oldname_count
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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?
debugging is cool
the debug helps alot!!!
some thing missing
I got the script working, but it did not process all files in the directory. If I have 3 files in the directory, it only process 2
thanks
Let>PuzzleCode=pr
GetFileList>c:\comictest\*.*,files
Separate>files,;,oldname
Let>k=0
Repeat>k
Let>thisfile=oldname_%k%
MidStr>%thisfile%,16,2,value1
MidStr>%thisfile%,19,2,value2
Let>newname=%PuzzleCode%%value1%_%value2%___%PuzzleCode%%value1%%value2%puzzle.eps
CopyFile>%thisfile%,c:\comictest\%newname%
Let>k=k+1
Until>k,oldname_count
thanks
Let>PuzzleCode=pr
GetFileList>c:\comictest\*.*,files
Separate>files,;,oldname
Let>k=0
Repeat>k
Let>thisfile=oldname_%k%
MidStr>%thisfile%,16,2,value1
MidStr>%thisfile%,19,2,value2
Let>newname=%PuzzleCode%%value1%_%value2%___%PuzzleCode%%value1%%value2%puzzle.eps
CopyFile>%thisfile%,c:\comictest\%newname%
Let>k=k+1
Until>k,oldname_count
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Change your Until line to:
Until>k>oldname_count
...
Or initialise k to 0 and increment at the start of the loop instead of the end.
Until>k>oldname_count
...
Or initialise k to 0 and increment at the start of the loop instead of the end.
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?