I do not really understand what you need. Do you need a method to start UltraEdit and the clipboard contents are automatically pasted into a new file using this application?
I do not understand why you do not simply assign a hotkey to the shortcut starting UltraEdit (shortcut properties), use this hotkey to start UltraEdit and press Ctrl+V to paste the current clipboard contents into the new file (with configuration setting
Create new Edit file when opening with no other files enabled) respectively when UltraEdit is already running, switch to UltraEdit, press Ctrl+N to create a new file and use Ctrl+V. With a hotkey for UltraEdit shortcut you need only 2 or 3 key presses to paste something into a new file by
- pressing hotkey of UltraEdit shortcut and then Ctrl+V, with Create new Edit file when opening with no other files enabled and Reload files previously open on startup not enabled or no file reloaded, OR
- pressing hotkey of UltraEdit shortcut, then Ctrl+N and last Ctrl+V, with Reload files previously open on startup enabled and files reloaded, OR
- pressing Alt+Tab (tab, tab) to switch to already running UltraEdit, press Ctrl+N and Ctrl+V.
However, if you really think you need this tool, you could specify on the command line following script for being executed.
Code: Select all
UltraEdit.selectClipboard(0);
// If there is no file open, create a new file.
if (UltraEdit.document.length < 1) UltraEdit.newFile();
else
{
var nLine = UltraEdit.activeDocument.currentLineNum;
var nColumn = UltraEdit.activeDocument.currentColumnNum;
if (typeof(UltraEdit.activeDocumentIdx) == "undefined") nColumn++;
// If there is a file open which contains already something, create new file.
if ((nLine > 1) || (nColumn > 1)) UltraEdit.newFile();
else
{
// The caret is at top of a file. Check if file contains anything.
UltraEdit.activeDocument.bottom();
nLine = UltraEdit.activeDocument.currentLineNum;
nColumn = UltraEdit.activeDocument.currentColumnNum;
if (typeof(UltraEdit.activeDocumentIdx) == "undefined") nColumn++;
if ((nLine > 1) || (nColumn > 1))
{
// This file also contains already something.
UltraEdit.activeDocument.top();
UltraEdit.newFile();
}
}
}
UltraEdit.activeDocument.paste();
You can specify also on command line the full name of a file not already existing and use configuration setting
Create new file if file specified on command line does not exist to let UltraEdit create this file.
Please note that script execution from command line does not work if an instance of UltraEdit is already running and you have not enabled the configuration setting
Allow multiple instances or use on the command line as first parameter
/fni to force a new instance of UltraEdit.