hi
Tidying my pdf invoices I thought of a very fine way to add user defined pre or post string to the pdf's file names
the user builds his prefixes list in list management
then when he wants to add a prefix
selects one file to prefix
hits the keyboard shortcut
a pop up apears with the prefixes list
he clicks on the chosen prefix
the filename is renamed
fast and elegant
Calude
pre or post fixed strings presets
-
calude
- Posts: 355
- Joined: 13 Aug 2008 10:16
- Location: Switzerland
- Contact:
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: pre or post fix strings presets
And already possible to do via scripting *scnr*

One of my scripts helped you out? Please donate via Paypal
-
calude
- Posts: 355
- Joined: 13 Aug 2008 10:16
- Location: Switzerland
- Contact:
Re: pre or post fixed strings presets
if you have nothing to do..... and are specially bored ....

-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: pre or post fixed strings presets
Code: Select all
$iniFile = self("path") . "\" . self("base") . ".ini";
if (exists($iniFile) != 1) { status "No .ini file found, aborted!", "8B4513", "stop"; end true; }
$pre = regexreplace(getsectionlist("Pre", $iniFile), "^\d+=");
$pre = regexreplace($pre, "^(.+?)(?=\r?\n|$)", "$1;$1<::>pre");
$post = regexreplace(getsectionlist("Post", $iniFile), "^\d+=");
$post = regexreplace($post, "^(.+?)(?=\r?\n|$)", "$1;$1<::>post");
$selection = popupmenu("$pre<crlf>-<crlf>$post<crlf>-<crlf>Edit .ini file;edit_ini_file;:cofi", , , , , , <crlf>);
if (!$selection) { status "No item selected, aborted!", "8B4513", "stop"; end true; }
if (strpos($selection, "<::>pre") != -1) {
rename "b", gettoken($selection, 1, "<::>") . "*";
}
elseif (strpos($selection, "<::>post") != -1) {
rename "b", "*" . gettoken($selection, 1, "<::>");
}
elseif (strpos($selection, "edit_ini_file") != -1) {
openwith "Notepad", , $iniFile;
}
folder as your script... Save the .ini file with UTF-16 LE BOM and add these sample
entries:
Code: Select all
[Pre]
1=Me_
2=Myself_
3=Our_
[Post]
1=_After
2=_Then
3=_Later
From then on, edit the .ini file to add / remove your pre- / post items...
One of my scripts helped you out? Please donate via Paypal
-
calude
- Posts: 355
- Joined: 13 Aug 2008 10:16
- Location: Switzerland
- Contact:
Re: pre or post fixed strings presets
Works like a charm!!!
although I had to find a UTF-16 LE BOM converter as notepad++ didnt seem to have one.
www.fileformat.info
thanks again highend
All the best
although I had to find a UTF-16 LE BOM converter as notepad++ didnt seem to have one.
www.fileformat.info
thanks again highend
All the best
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: pre or post fixed strings presets
It has, but it's not called UTF-16 but UCS-2 in Notepad++although I had to find a UTF-16 LE BOM converter as notepad++ didnt seem to have one
Since v18.40.0004 (probably, because it was not officially documented), XY supports
.ini files with UTF-8 / UTF-8 BOM as well
Official support was offered with v18.40.0003 but it only supported getkey and
getsectionlist was added afterwards
So you can use UTF-8 / UTF-8 BOM for the .ini file as well, as long your version
is younger...
As always, thanks for the donation!
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club