Part of DaVince Tools
Web Site: www.davince.com
Last Modified: July 8, 2004
#! txt2pdf
then wdavince will run the command file against the txt2pdf converter. This technique allows wdavince to save a command file to disk and be able to run it at a later time against the correct converter.
The following commands are valid in the command file:
cd create dir echo exit file goto info param profile wait
Refer to the Command Description section below for details on the syntax for each command.
Note: When a filename or directory name is specified as a parameter to one of the commands above, it must be enclosed in quotes if there is a space character included in the name. For example, to convert files in the "My Documents" directory, use the following command:
# this is the correct way
dir "c:\My Documents"
Instead of the following:
# this is the WRONG way
dir c:\My Documents
exit
The following commands were new or modified in version 2.1:create file goto wait
The following commands were new in version 2.0:
create echo info param
cd | changes the current directory used by the "file" and "dir" commands |
create | Specify the name of the PDF file to create |
dir | Convert specified directory |
echo | Echo text to the screen |
exit |
Exit script at this point,
creating the PDF file if files were previously specified for conversion. |
file | Convert specified file |
goto | Go to a specified label in the command file |
info | Add info strings to PDF file |
param | allows configuration parameters normally stored in the .ini file to be included in the command file |
profile | Specify the profile to use as defined in the INI file |
wait | wait a specified # of seconds |
cd directoryname
The "cd" command changes the current directory used by the "file" and "dir" commands. This command is useful when many files are contained in a single directory, which alleviates the need to prepend a path name to a file when using the "file" command.
create [ filename ] | [ dirname ] 1 [ force ] | [ dirname ] 2
The format of this command varies depending on the conversion mode used: many to one, one to one, or many to few. For many to one, only the PDF file name to create need be specified. For one to one, an optional output directory is specified along with the number "1". To force a PDF file to be created in one to one mode, even if the file has not changed, specify the keyword "force" after the "1" option. By default, the PDF file is not created if the PDF file date is newer than the original data file. If an output directory is not specified, then the PDF files are created in the same directory as the files to be converted. For many to few, an optional output directory is specified along with the number "2". If an output directory is not specified, then the PDF files are created in the same directories as the files to be converted.
This command should be specified prior to the file or dir commands.
A PDF file will not be created if the same filename with a ".LCK" extension is found. For example, if the file "d:\conversion\myfile.lck" is present, then the PDF file "d:\conversion\myfile.pdf" will not be created. This lock file feature allows a program to temporarily disable converting to PDF until all files are ready to be converted.
Examples:
To convert many files to one to a file named "conversion.pdf", use the following syntax:
dir directoryname [r]
The "dir" command specifies a directory to process. If an "r" is specified for argument 2, then the directory is processed recursively (similar to the "-r" command line option), otherwise, the directory is processed without recursion. Directory names with spaces in them must be enclosed with quotes. If a directory name contains a quote character, the quote must be preceded with a backslash character.
echo "text to display"
or
echo text to display
The "echo" command allows text to be displayed while processing the
command file. This is useful for displaying text to the user during
processing
of the command file.
exit
When this command is encountered, the script will exit, creating the PDF file if files were previously specified for conversion. This allows a script to exit prior to reaching the end of the file.
file filename [aliasname]
The "file" command specifies a file to convert. When an alias is specified for argument 2, this name is used when creating the bookmark instead of the filename. If the filename or the alias name contains spaces, then they must be enclosed in quotes. If either contains a quote character, the quote character must be preceded with a backslash character. If the alias name is not specified, then a default bookmark name is used based on the filename. If the bookmark name is specified as blank (two quotes only ""), then no bookmark is generated for that file. This allows bookmarks to selectively be created for certain files in the command file.
Beginning in version 2.1: The filename parameter can contain wild card characters. If wildcards are specified, then the aliasname parameter is ignored and a default bookmark name is used based on the filename.
goto label
Use this command to jump to a specific location in the command file. It is typically used in conjunction with the wait statement to monitor a folder for new files. A label defines the location where a goto statement can jump to. All labels must end in a colon (":") character. For example:
#! tiff2pdf
profile default
create 1
# labels must end in a colon (":")
watchloop:
dir "e:\watchdir"
# wait 60 seconds before trying again
wait 60
goto watchloop
info infokey infostring
This command adds strings to the PDF info dictionary. This dictionary contains information about the PDF file, including subject, author, and title. The keys are case sensitive. infostring should be enclosed in quotes. The command info keys are:
Subject - the subject of the PDF file
Author - the writer of the PDF file
Title - The title of the PDF file
param paramkey paramstring
The "param" command allows configuration parameters normally stored in the .ini file to be included in the command file. This allows one to create a profile dynamically or modify an existing profile by first using the "profile" command.
profile profilename
The "profile" command specifies the profile to use as defined in the INI file. The profile name must be a valid profile. This option is similar to the "-p" command line option, however, it allows for the profile to change during the processing of the command file.
wait seconds
Pause the execution of the command file for the specified number of seconds. See the "goto" command for an example.