Hi moka11
As far as I know there are no possibilities for automatic renaming of files in the FTP/SFTP dialog.
You could create a macro which
- select all text in your current document to clipboard
- open new blank file
- paste from clipboard
- find out how to construct a FTP path and filename without extension
- SaveAs with this name
- CloseFile
This should be possible in UE12, but as I am more of a script freak than a macro freak, in UE13 it could look like this:
Code: Select all
// Save local *.cob-file to FTP location without cob-extension in name
// Created: Jørgen Rasmussen, 2007-05-10. Please use and modify freely.
var myFTPaccount = "FTPSRVACCOUNT01";
var myFTPfolder = "/pathonserver/subfolder";
saveToMyFTP();
function saveToMyFTP() {
/* If already on a FTP server, save it directly and exit */
if (UltraEdit.activeDocument.isFTP()) {
UltraEdit.save();
return; /* exit now */
}
/* all unsaved and all local files that is not cob (Cobol) = end with error pop-up */
if (! UltraEdit.activeDocument.isExt("cob")) {
var errorTxt = UltraEdit.getString("Not saved locally as cob file. Enter any char and OK");
return; /* exit now */
}
/* otherwise: Construct a FTP path: "FTP::account\\path" */
var myFTPpath = "FTP::" + myFTPaccount + "\\"+ myFTPfolder;
/* Get local filepath */
var path = UltraEdit.activeDocument.path;
/* Get name path of file without extension */
var cobFileName = path.substr(path.lastIndexOf("\\")+1);
cobFileName = cobFileName.substr(0,cobFileName.lastIndexOf(".cob"));
/* Construct full path for FTP */
cobFilePath = myFTPpath+"|"+cobFileName;
UltraEdit.selectClipboard(8); /* choose user clipboard 8 */
UltraEdit.clearClipboard();
UltraEdit.save(); /* save local file */
UltraEdit.activeDocument.selectAll();
UltraEdit.activeDocument.copy();
UltraEdit.newFile();
UltraEdit.activeDocument.paste();
UltraEdit.saveAs(cobFilePath);
UltraEdit.closeFile(UltraEdit.activeDocument.path,2);
UltraEdit.clearClipboard();
UltraEdit.selectClipboard(0); /* restore to windows clipboard */
}
(Missing some setActive() in the end to return to the original tab, but setActive() still crashes UE, so it is omitted).
Assign to a hotkey and you have a nice "Save As Cob file to Mainframe" function.
It is not meant to force you to buy UE13, but it could serve as inspiration for you when writing a macro instead.