Open help of UltraEdit, select tab Index
, enter Command Line Parameters
, double click on found index entry, double click on first item in opened window to open the help page Command Line Parameters
. This help page explains two parameters you need for this task:
- /fni to force a new instance on running UltraEdit automated and which must be the first parameter on command line.
- /M,E="full path of macro file/macro name" to run a macro after starting UltraEdit automated and exit UE after finishing macro execution.
It depends on your macro if more is needed than a command line like this:
\IDM Computer Solutions\UltraEdit\uedit64.exe" /fni "
Path to CSV file\File Name.csv" /M,E="Path to macro file\Macro File Name.mac/Macro Name"
The macro could open itself the file "
Path to CSV file\File Name.csv"
in which case it would not be necessary to specify the file on command line.
This command line can be executed as is as scheduled task with appropriate task options.
A macro file can contain one or more macros. The optional /Macro Name
part in command line can be omitted if the specified macro file contains only one macro.
It looks like the macro to use for this task could contain something like:
Code: Select all
Open "Path to CSV file\File Name.csv"
IfNameIs "File Name"
Find RegExp "Search Expression 1"
Replace All "Replace Expression 1"
Find RegExp "Search Expression 2"
Replace All "Replace Expression 2"
Find RegExp "Search Expression 3"
Replace All "Replace Expression 3"
So this macro opens a local file with specified file path, name and extension.
Then it checks if the active file has really the expected file name, i.e. opening the file was successful. UltraEdit halts macro execution and shows an error message if the specified file could not be opened which needs to be confirmed by the user. So it is perhaps better to omit the command Open
in macro and specify the file to open on command line because in this case no error message is displayed if the configuration setting Create new file if file specified on command line does not exist
is enabled at Advanced - Settings or Configuration - Editor - New file creation
. I would use in this case additionally the macro commands
Code: Select all
This code to insert after the line IfNameIs "
results in exiting the macro if the file with right file name is empty, i.e. it was created by UltraEdit as the file specified on command line does not exist. Please note that UltraEdit does not really create this file on hard disk as long as nothing is written into the file and saved.
Next after opening the file with one of the two methods the regular expression replaces are executed on the file.
Finally the SaveAs
command is used to save the modified local file directly on server with uploading it via FTP. The specified account must be of course configured in FTP Account Manager
of UltraEdit. And the specified directory on server must exist too.
The local file as stored on hard disk is not modified by this macro, but that could be changed by inserting command Save
above the line with command SaveAs
UltraEdit exits itself after macro execution because of option ,E
on command line.
On using this UltraEdit command line method as scheduled task care must be taken which account is configured for the scheduled task as the default location of INI file of UltraEdit with the FTP account data depends on used user account. It would be possible to specify on command line additionally the INI file to use containing the FTP account data using /i="
Path to INI file\uedit64u.ini"
to explicitly define the INI file to use. This can be also a separate INI file with a non standard INI file name to make sure that this INI file for automated CSV file creation and upload containing the FTP account data is never modified by a user of the machine using additionally UltraEdit.