Command Line Placeholders for Tools

(available in EditPad Pro only)

EditPad Pro supports a range of placeholders that you can use on a tool’s command line to pass information about the file or parts of the file you’re editing in EditPad Pro.

PlaceholderMeaning in tool command line
%POS%Number of bytes before the position of the text cursor. Depending on the file’s encoding, the number of bytes may not equal the number of characters.
%LINE%Number of the line the text cursor is on.
%COL%Number of the column the text cursor is on.
%LINETEXT%Text of the line the text cursor is on.
%CHAR%The character immediately to the right of the text cursor.
%WORD%The word under the text cursor.
%SELSTART%Number of bytes before the start of the selection.
%SELSTOP%Number of bytes before the end of the selection. Subtracting %SELSTART% from %SELSTOP% gives the length of the selection in bytes.
%WORD%The selected text if the selection does not span multiple lines. The selected part of the first line in the selection if the selection spans multiple lines. The word under the cursor if there is no selection.
%ENCODING%Encoding used by the active file, such as utf-8, windows-1252, iso-8859-1, etc.

Path Placeholders

You can use path placeholders to use part or all of the path and the file name of the file you are currently editing. You can use them in the command line and working folder for tools. This way, you can have a tool work with the file you are editing in EditPad Pro. In the examples below, the file being edited is C:\data\files\web\log\foo.bar.txt. If the current file is untitled, all the placeholders below will be replaced with nothing.

If you want to use the path or name of the temporary file that EditPad Pro can open or save when running a tool, simply prepend TEMP to the name of the placeholder. E.g. %TEMPFILE% is the full path and filename to the temporary file. %TEMPPATH% is the folder the temporary file is in.

If the file was opened via FTP, use %FTPFILE% to specify the full path to the file on the FTP server. %FTPSERVER% is the domain name of the server, and %FTPURL%: the full ftp:// URL to the file.

If you want to pass more than one file on the tool’s command line, you can use %PICK1FILE% through %PICK9FILE% to specify (parts of) the paths of up to 9 files that you have already open in EditPad Pro. If you use these placeholders, each time you run the tool a window will pop up for you to select the file(s) to be passed on the command line from the files you have open in EditPad Pro. The files you select will be saved automatically so the tool can get their current contents. If you don’t want the files to be saved, use %TEMP1FILE% through %TEMP9FILE% instead. These placeholders show the same file picker for files open in EditPad Pro. They don’t save the files but save temporary copies instead. The paths to the temporary copies are passed to the tool.

If you want to pass any file, regardless of whether it is open in EditPad Pro or not, use %DISK1FILE% through %DISK9FILE%. These placeholders show a regular open file dialog so you can select a file from disk. If you select a file that is open in EditPad Pro, any unsaved changes are not saved.

All the %FILE% placeholders described in this section represent a whole series of placeholders that hold various parts of the file’s path.

PlaceholderMeaningExample
%FILE%The entire path plus filename to the fileC:\data\files\web\log\foo.bar.txt
%FILENAME%The file name without pathfoo.bar.txt
%FILENAMENOEXT%The file name without the extensionfoo.bar
%FILENAMENODOT%The file name cut off at the first dotfoo
%FILEEXT%The extension of the file name without the dottxt
%FILELONGEXT%Everything in the file name after the first dotbar.txt
%PATH%The full path without trailing delimiter to the fileC:\data\files\web\log
%DRIVE%The drive the file is on, without trailing delimiterC: for drive letter paths; \\server for UNC paths
%FOLDER%The full path without the drive and without leading or trailing delimitersdata\files\web\log
%FOLDER1%First folder in the pathdata
%FOLDER2%Second folder in the pathfiles
(...etc...)
%FOLDER99%99th folder in the path.(nothing)
%FOLDER<1%Last folder in the pathlog
%FOLDER<2%Second folder from the end in the pathweb
(...etc...)
%FOLDER<99%99th folder from the end in the path.(nothing)
%PATH1%First folder in the path, without delimitersdata
%PATH2%First two folders in the path, without leading or trailing delimitersdata\files
(...etc...)
%PATH99%First 99 folders in the path, without leading or trailing delimitersdata\files\web\log
%PATH<1%Last folder in the path, without delimiterslog
%PATH<2%Last two folders in the path, without leading or trailing delimitersweb\log
(...etc...)
%PATH<99%Last 99 folders in the path, without leading or trailing delimitersdata\files\web\log
%PATH-1%Path without the drive or the first folderfiles\web\log
%PATH-2%Path without the drive or the first two foldersweb\log
(...etc...)
%PATH-99%Path without the drive or the first 99 folders.(nothing)
%PATH<-1%Path without the drive or the last folderdata\files\web
%PATH<-2%Path without the drive or the last two foldersdata\files
(...etc...)
%PATH<-99%Path without the drive or the last 99 folders.(nothing)

Combining Path Placeholders

You can string several path placeholders together to form a complete path. If you have a file c:\data\test\file.txt then d:\%FOLDER2%\%FILENAME% will be substituted with d:\test\file.txt. However, if the original file is c:\more\file.txt then the same path will be replaced with d:\\file.txt because %FOLDER2% is empty. The result is an invalid path.

The solution is to use combined path placeholders, like this: d:\%FOLDER2\FILENAME%. The first example will be substituted with d:\test\file.txt just the same, and the second will be substituted with d:\file.txt, a valid path. You can combine any number of path placeholders into a single path placeholder, separating them either with backslashes (\) or forward slashes (/). Place the entire combined placeholder between two percentage signs.

A slash between two placeholders inside the combined placeholder is only added if there is actually something to separate inside the placeholder. Slashes between two placeholders will never cause a slash to be put at the start or the end of the entire resulting path. In the above example, the backslash inside the placeholder is only included in the final path if %FOLDER2% is not empty.

A slash right after the first percentage sign makes sure that the resulting path starts with a slash. If the entire resulting path is empty, or if it already starts with a slash, then the slash is not added.

A slash right before the final percentage sign makes sure that the resulting path ends with a slash. If the entire resulting path is empty, or if it already ends with a slash, then the slash is not added.

Mixing backslashes and forward slashes is not permitted. Using a forward slash inside a combined placeholder, will convert all backslashes in the resulting path to forward slashes. This is useful when creating URLs based on file names, as URLs use forward slashes, but Windows file names use backslashes.

Example: If the original path is c:\data\files\web\log\foo.bar.txt

PlaceholdersResulting path
%\FOLDER1\%\data\
%\FOLDER5\%(nothing)
%PATH-2\FILENAME%web\log\foo.bar.txt
%PATH-2/FILENAME%web/log/foo.bar.txt 
%PATH-4\FILENAME%foo.bar.txt
%DRIVE\PATH-2\FILENAME%c:\web\log\foo.bar.txt 
%DRIVE\PATH-4\FILENAME%c:\foo.bar.txt 
%\FOLDER1\FOLDER4\%\data\log\
%\FOLDER1\FOLDER5\%\data\

Placeholders That Prompt

If the parameters you want to pass to the tool aren’t always the same, you can add a placeholder that EditPad prompts for when you run the tool. Anything in the form of %PLACEHOLDER% that EditPad doesn’t recognize is treated as a custom placeholder. You will be prompted to enter the text that this placeholder should be substituted with.

If you want to pass the paths to one or more files you have open in EditPad, use a path placeholder prefixed with PICK and a number from 1 to 9. E.g. %PICK1FILE% lets you pick file #1 and adds its whole path to the command line. If you use multiple placeholders with the same number you will be prompted for only one file. You can use different numbers to be prompted for up to 9 files.

If you want to pass the path to a temporary copy of a file you have open in EditPad, prefix TEMP with a number from 1 to 9 instead. E.g. %TEMP2FILE% lets you pick file #2 and passes the full path to a temporary copy of the file. That copy is created by EditPad before it runs the tool.

If you want to pass the path to any other file, use a path placeholder prefixed with DISK and a number from 1 to 9. EditPad will show a file selection dialog that lets you pick a file on disk when you run the tool.