This is not possible directly with an UltraEdit command. But it is possible using a third-party tool and more customized using the third-party tool and a script.
First you would need the cool program ConGetFile
, a freeware tool to select a file from within a console window (command line) by using the standard file open dialog of Windows. Download and unpack ConGetFile
to any location.
Next you would have to setup a user tool at Advanced - Tool Configuration
with following settings:
Menu Item Name: Get File Name
Command Line: "Path to ConGetFile\ConGetFile.exe"
Working Directory: Preferred (image) directory or %p or %rp
Toolbar bitmap/icon (file path): let it empty or create a *.bmp/*.ico suitable for your toolbar and select this file
Note 1: The double quotes around the full file name of ConGetFile are not necessary when there is no space in the path.
Note 2: The working directory is always without double quotes even when the path contains a space character. %p is for path of active file, %rp is for project path if you are working with a project.
Program Type: Dos Program
Save Active File: unchecked
Save all files first: unchecked
Command Output (DOS Commands): Append to Existing (ignored)
Show DOS Box: unchecked
Capture Output: checked
Replace selected text with: Captured Output
When you execute this tool now and nothing is currently selected, a file open dialog opens which lets you select a file. The full name of the selected file is then inserted with an additional line break into the current file at the current cursor position. If there is something selected when executing the tool, the selection is replaced by the full file name and the line break.
The line break is annoying here. It can be avoided using a second tool directly with ConGetFile - Clip.exe
from Microsoft, and running the tool via a script.
The command line of the user tool must be changed to:"Path to ConGetFile\ConGetFile.exe" | "Path to Clip\Clip.exe"
On tab Output
two options must be changed:
Capture Output: unchecked
Replace selected text with: No Replace
So now the user tool copies the full name of the selected file (with the line break) to the Windows clipboard. To paste now just the file name into the active file overwriting the current selection if there is one, you need a script which calls the user tool and then edits the string in the clipboard before pasting it into the active file. The script can be made smart enough to convert the absolute path of the image file to a path relative to the path of the active file before (over)writting the file name into the active file. Add this script to your list of scripts with a hotkey for fast execution and with all this effort you would have an image file selector tool.
By the way: Using these two small tools with one user tool is a good help for any script where the user should be able to select one file on which the script should do something.