Piotr:
--------------------------------------------------------------------------------
Good morning,

is it possible to use the ALT + D (date in my custom text) shortcut in editing
the name of a file / directory?

It makes a lot easier ...

Thanks for the great editor
--------------------------------------------------------------------------------


Hi,
I'm not sure, this functionality for inserting a timestamp can be use in
filenames (maybe it is limited to the editor text and not available for
filesystem operations (?))
However, it might be possible to achieve a similar functionality with PSPad
Scripting.

You may try e.g. the following approach or tweak it to your needs. The scripting
might need to be activated in program settings - system integration. The code
below can be saved in a js. file in the Script directory; after that, call the
menu Script: Recompile scripts.

The shortcut can be changed as well as the time format etc.


hth,
  vbr 

cite:
--------------------------------------------------------------------------------
/////// ... PSPad\Script\JScript\SaveFileTimestamp.js ////////
var module_name = "SaveFileTimestamp";
var module_ver = "1";

function save_file_name_with_timestamp(){
//save the active editor text with pre-filled timestamp in the filename
if (editorsCount()<1){return;}
var actEd = newEditor();
actEd.assignActiveEditor();
var fileNameStr = actEd.fileName();
var dt = new Date();
var str_dt =
"__"+dt.getFullYear()+"_"+(dt.getMonth()+1)+"_"+dt.getDate()+"__"+dt.getHours()+
"_"+dt.getMinutes()+"_"+dt.getSeconds()+"_";
str_dt = str_dt.replace(/_(\d)_/g, "_0$1_"); // pad single-digit items with
zeros
str_dt = str_dt.replace(/_$/g, ""); // remove trailing _
if ((path_match = fileNameStr.match(/^(.*)\.([^.
]*?)$/)) != null){
path_file_part = path_match[1];
path_ext_part = path_match[2];
fileNameStr = path_file_part + str_dt + "." + path_ext_part;
}

// save directly
// actEd.saveFileAs(fileNameStr); 

// save as dialog with a pre-filled timestamp
actEd.fileName(fileNameStr);
runPSPadAction("aSaveAs");
}

function Init(){
addMenuItem("save filename - timestamp", "",
"save_file_name_with_timestamp","Ctrl+Alt+Shift+W");
}

--------------------------------------------------------------------------------


-- 
<https://forum.pspad.com/read.php?2,77266,77271>
PSPad freeware editor https://www.pspad.com

Odpovedet emailem