Code: Select all
::new "Links_<curfolder>_<date yyyy-mm-dd>.txt", file, ,; rename s, "__/_", r;Can someone please help...?
Thanks!
Code: Select all
::new "Links_<curfolder>_<date yyyy-mm-dd>.txt", file, ,; rename s, "__/_", r;Code: Select all
::new "Links_<curfolder>_<date yyyy-mm-dd_hh^nn%ss>.txt", file, ,; rename s, "^/h"; rename s, "%/min"; rename s, "__/_"; open <curitem>Code: Select all
new "Links_" . RegexReplace("<curfolder>","_+","_") . "_<date yyyy-mm-dd_hh\hnn\mi\nss>.txt";open "<curitem>";So I can have:-but I'd prefer this having the "Links_<curfolder>_<date yyyy-mm-dd.txt" format, renaming "__/_" when occurring, appending numbers on name collision and ready in rename mode (3-state define-able, when implemented)...
So you want to create a file using the clipboard as its contents.SkyFrontier wrote:I'm trying to emulate "Paste Text Into New File (CTRL+ALT+V)" but with some level of customization, in ways current "Copy here with date" does. ^^
Code: Select all
"Do Stuff"
// Filename before the (possible) suffix.
$prefix = 'Links_' . RegExReplace("<curfolder>", '_+', '_') . "_<date yyyy-mm-dd>";
// Filename after the (possible) suffix.
$ext = '.txt';
/* Use the user defined suffix pattern.
* Note that the value is taken from the config file,
* which means if it has changed since last saved
* those changes will not be reflected here.
* You could call SaveSettings(); or #193; here to fix that.
*/
$suffix = GetKey('PostfixNum','General');
/* This splits the pattern into three parts
* pre: Anything before the last set of zeros.
* zed: The last set of zeros.
* suf: Anything after the last set of zeros.
*/
$suffix = RegExReplace("$suffix", '^(.*?[^0]?)(0+)([^0]*)$', "$1<crlf>$2<crlf>$3");
$suffix_pre = GetToken("$suffix", 1, "<crlf>");
$suffix_zed = GetToken("$suffix", 2, "<crlf>");
$suffix_suf = GetToken("$suffix", 3, "<crlf>");
$suffix = '';
// Check for collisions and increment suffix pattern.
$min_lead = StrLen("$suffix_zed");
$i = 0;
while (Exists("<curpath>\$prefix$suffix$ext") != 0) {
$i = $i + 1;
$suffix = "$suffix_pre" . StrRepeat('0', $min_lead - StrLen("$i")) . "$i$suffix_suf";
}
// Write clipboard's contents to file.
$err = WriteFile("<curpath>\$prefix$suffix$ext", "<clipboard>", 'n');
End($err != 1, "Could not write file:<crlf>$prefix$suffix$ext");Code: Select all
focus $errCode: Select all
SelFilter("$prefix$suffix$ext");
Focus('L');
#172; //File -> Rename