Page 5 of 8

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 18:04
by highend
1. Use my script to convert your tag.dat file (use the semicolon in the input dialog)
2. Apply the tweak (and ofc use the semicolon as the delimiter)
3. Add your tags inside XY as necessary...

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 18:36
by Ryan
highend wrote:1. Use my script to convert your tag.dat file (use the semicolon in the input dialog)
2. Apply the tweak (and ofc use the semicolon as the delimiter)
3. Add your tags inside XY as necessary...
So, this will allow me to have a tag such as the one below without having the comma delimit the tag into two separate tags?

"Surnames, Jewish—Lists and Histories"

?

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:03
by admin
To put it this way: yes.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:11
by Ryan
Ryan wrote:
highend wrote:1. Use my script to convert your tag.dat file (use the semicolon in the input dialog)
2. Apply the tweak (and ofc use the semicolon as the delimiter)
3. Add your tags inside XY as necessary...
Ok, I have the tag.dat file open in Notepad... Where do I insert your script within that file?

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:22
by highend
Ok, I have the tag.dat file open in Notepad... Where do I insert your script within that file?
It's a script, not something that is pasted into an .ini file...

Menu - Scripting - Run Script

Paste my script into that box and hit ok.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:25
by bdeshi
Hey, wait. You should run this script. It's a modified version of highend's original script with a few fixes, or rather, updates.
HOWTOUSE: From XY main menu, select Scripting > Run Script. copy and paste this script code there, then press OK. Then follow direction that pop up.

Code: Select all

//rewrites tag database with modified tag separator at ini\Settings\TagsSeparator
//--changes from highend's original --
// some invisible handholding, updated disallowed separators list, reopens inputbox in case of invalid input,
// and most importantly, set the new tweak!  :wink: 
    savesettings;
    $tagFile = "<xydata>\tag.dat";
    $tagFileContent = readfile($tagFile);
    $tagFileHeader  = gettoken($tagFileContent, 1, "Data:<crlf>");
    $tagFileTags    = gettoken($tagFileContent, 2, "Data:<crlf>");

    $tagFileVer = regexreplace($tagFileContent, "(XYplorer File Tags v)(\d+)", "$2");
    if ($tagFileVer < 3) { status "tag.dat file must be of version 3 (or later), aborted!", "8B4513", "stop"; end 1==1; }
    $delim = '';
    while ((strlen($delim)!=1) || (regexmatches($delim, "(\|\<|\>|\*|\?)"))){
        $delim = input("Type new tag delimiter here", "Only single character delimiters are possible.<crlf>'<>|*?' are not allowed!", , , , 250, 150);
        if (regexmatches($delim, "(\|\<|\>|\*|\?)")) { status "$delim is not allowed as a replacement delimiter!", "8B4513", "stop"; }
        if (strlen($delim) > 1) { status "The delimiter can only be a SINGLE character!", "8B4513", "stop"; }
    }

    $newTags = "";
    foreach($entry, $tagFileTags, "<crlf>") {
        if !($entry) { continue; }
        $tags = gettoken($entry, 3, "|");
        if ($tags) {
            $newTags = $newTags . regexreplace($entry, "^(.*?\|\d+\|)([^\|]*)(.*(?=$))", "$1" . replace($tags, ",", $delim) . "$3") . "<crlf>";
        } else { $newTags = $newTags . $entry . "<crlf>"; }
    }
    if (confirm("Write the converted tag.dat file back?<crlf 2>(Advice: press OK)")) {
        writefile($tagFile, $tagFileHeader . "Data:<crlf>" . $newTags);
    }
    setkey $delim, 'TagsSeparator', 'Settings';
    echo "XYplorer will automagically restart now, don't worry.",' ',,0;
    exit 'nr';
edit: hotfixed a regexp mismatch!
edit: now it explicitly points out where to enter the delimiter

Remember to close that Notepad window you'd opened earlier without saving any changes to tag.dat
Also remember to separate newly added tags with the new separator that you're gong to pick.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:37
by Ryan
Ok... Getting closer.

Where in the script do I specify my desired semicolon delimiter?

I appreciate both of you staying with me on this.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:39
by bdeshi
HOWTOUSE: From XY main menu, select Scripting > Run Script. copy and paste this script code there, then press OK. Then follow directions that pop up.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 19:46
by highend
1. Use my script to convert your tag.dat file (use the semicolon in the input dialog)
Sorry, this is getting ridiculous...

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 20:51
by Ryan
Look, I don't have the expertise in this that the rest of you apparently have. I am trying to understand your instructions but you are assuming that I know my way around a procedure like this but I simply do not! "Use my script to convert your tag.dat file (use the semicolon in the input dialog)"... WHERE IS THE INPUT DIALOGUE??? I don't know where to put the semicolon.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 21:33
by bdeshi
temper, temper.
Just follow my instructions up ^there^.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 21:43
by Linkaday
HTH

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 22:36
by Ryan
Hi Linkaday,

You are very kind - thank you. When I get to step 4, the popup says "Convert tag delimiter" rather than "Type new tag delimiter here." I type the semicolon in the field, hit enter, and the next popup says "Write the converted tag.dat file back?" I select ok, but that seems to cancel the process rather than to execute it.

I am running the trial version of the program: Is that what is preventing me from making progress?

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 22:40
by highend
I select ok, but that seems to cancel the process rather than to execute it.
Why does it seem so, did you take a look at the rewritten tag.dat?
Is that what is preventing me from making progress?
No.

Re: I want to use XYplorer as a library cataloging program

Posted: 30 Jul 2015 22:44
by Ryan
highend wrote:
I select ok, but that seems to cancel the process rather than to execute it.
Why does it seem so, did you take a look at the rewritten tag.dat?
Is that what is preventing me from making progress?
No.
It seems to cancel the process because this is what I type for tags:

Surnames, Jewish—Lists and Histories;
Jewish Identities

But this is what the new script turns that into:

Jewish Identities; Jewish—Lists and Histories; Surnames

My opinion is that the script is simply replacing the comma with a semicolon and breaking up the script the same way, only with a different delimiter.