UltraEdit macros do not support variables. There can be used only
^s (selected text) and
^c (content of active clipboard) in some commands like
Open (file open),
SaveAs (file save as),
Find,
Replace,
FindInFiles and
ReplInFiles. In an UltraEdit macro it is only possible to use macro command
CopyFilePath to copy full qualified file name to active clipboard, paste that string into active file with command
Paste and use a regular expression
Find or
Replace to get or change the pasted string to host name of server.
Here is an example macro code which puts just host name of current file into clipboard 9 for usage with
^c or pasting into file with
Paste in syntax for UltraEdit for Windows < v25.00.
Code: Select all
InsertMode
ColumnModeOff
HexOff
Clipboard 9
CopyFilePath
Top
Paste
"
"
SelectToTop
PerlReOn
Find MatchCase RegExp SelectText "S?FTP::\K([^/\\|]+)"
Copy
DeleteLine
... other macro commands ...
ClearClipboard
Clipboard 0
For UltraEdit for Windows v25.00 or any later version the line with command
Find must be with escaping
\\ with one more backslash:
Code: Select all
Find MatchCase RegExp SelectText "S?FTP::\K([^/\\\|]+)"
UltraEdit scripts support variables and therefore it is with just one line possible to get from string variable with full qualified file name of active file the host name part assigned to a string variable like
sHostName by using:
Code: Select all
var sHostName = UltraEdit.activeDocument.path.replace(/^S?FTP::([^\/\\|]+).*$/,"$1");