First, UltraEdit can be started with the parameter
/f"file list file". So if you create a shortcut to uedit32.exe and append on the command line of the shortcut
/fC:\Temp\test.ini you perhaps don't need a macro to start UltraEdit with a dynamically created list of files to open. The "file list file" must contain only file names with full path, one file per line. Double quotes around the file name of the list file are only needed if the full file name of the list file contains 1 or more spaces. That is the method I use to start UltraEdit with a file list file created by my favorite file manager Total Commander which creates that list file in temp folder and deletes it also automatically on exit of UltraEdit.
To open files with a macro from a list of files use following macro:
- Code: Select all
InsertMode
ColumnModeOff
HexOff
Open "C:\Temp\test.ini"
Bottom
IfColNumGt 1
InsertLine
IfColNumGt 1
DeleteToStartofLine
EndIf
EndIf
Top
Loop
IfEof
ExitLoop
EndIf
StartSelect
Key END
IfSel
Open "^s"
IfSel
Else
PreviousWindow
EndIf
EndIf
EndSelect
Key HOME
Key DOWN ARROW
EndLoop
CloseFile NoSave
The macro opens the list file. Next it first checks if the last line of the file has a line termination. If there is no line termination at end of file, it inserts one and makes sure that no additional spaces/tabs are inserted in case last line of file starts with spaces/tabs and auto-indent feature is enabled although this is most likely not the case for this file. It is extremly important for this macro that there is a line termination at end of file otherwise the following loop would be really an endless loop.
Inside the loop first a check is done if the caret in the list file has reached end of file and if this is true, the loop is exited and the list file is closed without saving it in case it was modified.
The main loop task is to select active line without line termination and use the selected string in the File Open command referenced by
^s. In case the current line is a blank line, it is ignored. If the file could not be opened, the list file is still active. Therefore the switch back to the list file with command
PreviousWindow is done only when nothing is selected in active file which is true for just opened files.
A regular expression find could be also used to select names of files. But then the condition to break the loop must be
IfNotFound below the
Find command instead of
IfEof. The caret is not moved to end of file if a searched string is not found anymore in file and therefore
IfEof would not become true ever.
For opening a file in a new instance of UltraEdit whose file name is currently selected in the active file, you can use a user tool with following command line:
"full path to uedit32.exe\uedit32.exe" /fni "%sel%"The double quote characters arround
%sel% are important in case of 1 or more spaces in selected file name. Please note that the program type for this tool must be
Windows program because UltraEdit is not a DOS or console application.
Correction: The parameter
/fni (force new instance) was introduced with UE v13.10 and is therefore not available in your old version of UltraEdit. So you have to enabled configuration setting
Allow multiple instances to be able to open a file whose name is selected in active file in a new instance of UltraEdit.