Processing multiple files in a directory
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 1
- Joined: Fri Jan 30, 2004 3:36 am
Processing multiple files in a directory
I am using an application from Xerox to convert files from its scanned file format (.rdo) to pdf. I would like to automate it to process an entire directory of rdo files. Each file take several minutes to process. We use windows 2000 and acrobat 5.0. Writing the basic script to open the rdo - and export it to pdf is straight forward but I have no idea how to script the process of opening and exporting multiple files. I have no experience with visual basic. I am hoping to find a way using Macro Scheduler commands. Any ideas would be greatly appreciated.
Thanks
Thanks
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Quick answer is YES you will be able to do this in Macro Scheduler.
No time to provide example right now, but someone may be back with an answer before me. Just wanted to let you know Macro Scheduler is the correct answer for you.
Here is extract from Help on Separate> command:
=========================================
Separate>list,delimiter,returnvar
Separate takes a list, a delimiter and returns the elements of the list. The command returns a number of variables, one for each list element, each with the suffix "_n" where n is the index of the element in the list. The variable names are determined by the name given in returnvar. e.g. returnvar_1, returnvar_2, etc. Also returned is the number of elements in the list, in returnvar_count.
Abbreviation : SEP
Example
GetFileList>c:\temp\*.*,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Until>k,file_names_count
==============================
Use this with Run Program> where Run Program would replace the example Message. Assumes you can pass filenames to your conversion program. Sumething like:
Use Position and MidStr to separate filename core from filename extension.
Run Program>c:\folder\converter.exe c:\data\rdo\file_names_%k%c:\data\pdf\%filenamecore%.pef
No time to provide example right now, but someone may be back with an answer before me. Just wanted to let you know Macro Scheduler is the correct answer for you.
Here is extract from Help on Separate> command:
=========================================
Separate>list,delimiter,returnvar
Separate takes a list, a delimiter and returns the elements of the list. The command returns a number of variables, one for each list element, each with the suffix "_n" where n is the index of the element in the list. The variable names are determined by the name given in returnvar. e.g. returnvar_1, returnvar_2, etc. Also returned is the number of elements in the list, in returnvar_count.
Abbreviation : SEP
Example
GetFileList>c:\temp\*.*,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Until>k,file_names_count
==============================
Use this with Run Program> where Run Program would replace the example Message. Assumes you can pass filenames to your conversion program. Sumething like:
Use Position and MidStr to separate filename core from filename extension.
Run Program>c:\folder\converter.exe c:\data\rdo\file_names_%k%c:\data\pdf\%filenamecore%.pef
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Re: Processing multiple files in a directory
this doesn't work too well if directory is empty....
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Re: Processing multiple files in a directory
To check for empty folder...
Code: Select all
GetFileList>c:\temp\*.*,files
// ADDED
Length>Files,FilelistLen
If>FileListLen>0
(then use script from Bob)
//
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Until>k,file_names_count
else
MDL>No files found
endif
Re: Processing multiple files in a directory
instead ofJerry Thomas wrote:To check for empty folder...
Code: Select all
GetFileList>c:\temp\*.*,files // ADDED Length>Files,FilelistLen If>FileListLen>0 (then use script from Bob) // Separate>files,;,file_names MessageModal>Num Files: %file_names_count% Let>k=0 Repeat>k Let>k=k+1 Message>file_names_%k% Until>k,file_names_count else MDL>No files found endif
Code: Select all
*.*
Code: Select all
*.exe and *.com and *.bat
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Re: Processing multiple files in a directory
There are a couple of things you might have been trying to do so I show 2 techniques
You should be able to run this as is since I used c:\Windows
You should be able to run this as is since I used c:\Windows
Code: Select all
// Get the list of all files
GetFileList>c:\Windows\*.*,files
// Convert to upper case
UpperCase>files,files
// This is the position of the first occurrence - NOT the number of occurrences
Position>.JPG,files,1,JPG_Exists
Position>.EXE,files,1,EXE_Exists
// If 1 or more of the files types exist...
If>{(%JPG_Exists%>0) or (%EXE_Exists%>0)
// break the string of files names into an array
Separate>files,;,file_names
MessageModal>Total number of files: %file_names_count%
// Counters
Let>k=0
Let>EXE_Count=0
Let>JPG_Count=0
// Loop through all of the file names
Repeat>k
// increment the counter
Let>k=k+1
// Get the extension of the file
ExtractFileExt>file_names_%k%,FileExt
// ***** YOU CAN USE THIS TECHNIQUE **************
// If file type matches what you are looking for
If>{(%FileExt%=".EXE") or (%FileExt%=".JPG")}
MessageModal>file_names_%k%
endif
// ***** OR USE THIS APPROACH *******************
If>FileExt=.EXE
Let>EXE_Count=EXE_Count+1
endif
If>FileExt=.JPG
Let>JPG_Count=JPG_Count+1
endif
// ***********************************************
// Repeat until counter = number of files
Until>k,file_names_count
else
MessageModal>No files found
endif
MessageModal>EXE Files: %EXE_Count%%CRLF%JPG Files: %JPG_Count%
-
- Newbie
- Posts: 13
- Joined: Tue Oct 06, 2020 6:28 pm
Re: Processing multiple files in a directory
Thanks all..................