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.
|Placeholder||Meaning in tool command line|
|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.|
|Number of the line the text cursor is on.|
|Number of the column the text cursor is on.|
|Text of the line the text cursor is on.|
|The character immediately to the right of the text cursor.|
|The word under the text cursor.|
|Number of bytes before the start of the selection.|
|Number of bytes before the end of the selection. Subtracting %SELSTART% from %SELSTOP% gives the length of the selection in bytes.|
|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 used by the active file, such as utf-8, windows-1252, iso-8859-1, etc.|
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.
|The entire path plus filename to the file||C:\data\files\web\log\foo.bar.txt|
|The file name without path||foo.bar.txt|
|The file name without the extension||foo.bar|
|The file name cut off at the first dot||foo|
|The extension of the file name without the dot||txt|
|Everything in the file name after the first dot||bar.txt|
|The full path without trailing delimiter to the file||C:\data\files\web\log|
|The drive the file is on, without trailing delimiter||C: for drive letter paths; \\server for UNC paths|
|The full path without the drive and without leading or trailing delimiters||data\files\web\log|
|First folder in the path||data|
|Second folder in the path||files|
|99th folder in the path.||(nothing)|
|Last folder in the path||log|
|Second folder from the end in the path||web|
|99th folder from the end in the path.||(nothing)|
|First folder in the path, without delimiters||data|
|First two folders in the path, without leading or trailing delimiters||data\files|
|First 99 folders in the path, without leading or trailing delimiters||data\files\web\log|
|Last folder in the path, without delimiters||log|
|Last two folders in the path, without leading or trailing delimiters||web\log|
|Last 99 folders in the path, without leading or trailing delimiters||data\files\web\log|
|Path without the drive or the first folder||files\web\log|
|Path without the drive or the first two folders||web\log|
|Path without the drive or the first 99 folders.||(nothing)|
|Path without the drive or the last folder||data\files\web|
|Path without the drive or the last two folders||data\files|
|Path without the drive or the last 99 folders.||(nothing)|
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
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.