What is wrong with this code? It returns an invalid file name at the IFFileChanged line.
GetFileList>U:\Reports\EDIF_BATCH\*.txt,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
IfFileChanged>U:\Reports\EDIF_BATCH\file_names_%k%,NOPE
Label>YUP
Messagemodal>file_names_%k% YUP, less than 1
Goto>SKIPNO
Label>NOPE
MessageModal>file_names_%k% NOPE, more than 1
Label>SKIPNO
Until>k,file_names_count
Label>End
If FileChanged Problem
Moderators: JRL, Dorian (MJT support)
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Hi Tony.....thanks for the clear example to work with. Made it easy.
Your original code is provided below with comments in bold blue, and modifications in bold red:
If you single step through the code, you can see the values of file_names_%k% in the Show Watch List window.
Your original code is provided below with comments in bold blue, and modifications in bold red:
GetFileList>U:\Reports\EDIF_BATCH\*.txt,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
//Remove the file path, it is already included in file_names_%k% variable.
//IfFileChanged>U:\Reports\EDIF_BATCH\file_names_%k%,file_names_%k%,NOPE
Label>YUP
Messagemodal>file_names_%k% YUP, less than 1
Goto>SKIPNO
Label>NOPE
MessageModal>file_names_%k% NOPE, more than 1
Label>SKIPNO
Until>k,file_names_count
Label>End
If you single step through the code, you can see the values of file_names_%k% in the Show Watch List window.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
If I understand you, here is a suggestion, no time for good code now.
Use Position, and MidStr to parse out the file name.
1. Assume no underscore (_) in filenames.
2. Find position of _ in the current filename.
3. Subtract 1 from that position to locate the last character of the name.
4. Use MidStr to pull out the filename
Something like this:
Use Position, and MidStr to parse out the file name.
1. Assume no underscore (_) in filenames.
2. Find position of _ in the current filename.
3. Subtract 1 from that position to locate the last character of the name.
4. Use MidStr to pull out the filename
Something like this:
NOTE: The code above is quick and dirty, not tested, just wanted to pass on the idea....Position>_,filename_%k%,1,Stop
Let>Stop=%Stop%-1
MidStr>filename_%k%,1,%Stop%,filename
MessageModal>Filename is %filename%.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada
I messed with variations of all this and did not get the results I wanted, so I started from scratch and came up with this which works. Thanks for your help, Bob.
GetFileList>U:\Reports\EDIF_BATCH\*.txt,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
IfFileChanged>file_names_%k%,NOPE
Label>YUP
Let>FYUP=file_names_%k%
Messagemodal>Yes-More than 1%CRLF%%FYUP%
Goto>SKIPNO
Label>NOPE
Let>FNOPE=file_names_%k%
Messagemodal>No-Less than 1%CRLF%%FNOPE%
Label>SKIPNO
Until>k,file_names_count
GetFileList>U:\Reports\EDIF_BATCH\*.txt,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
IfFileChanged>file_names_%k%,NOPE
Label>YUP
Let>FYUP=file_names_%k%
Messagemodal>Yes-More than 1%CRLF%%FYUP%
Goto>SKIPNO
Label>NOPE
Let>FNOPE=file_names_%k%
Messagemodal>No-Less than 1%CRLF%%FNOPE%
Label>SKIPNO
Until>k,file_names_count