Why not kill two birds with one stone?Leopoldus wrote:I think, sofware is to serve a man, not to teach him a life philosophy![]()
Do you know that file commenting is built into Win2K/XP? (see File Properties dialog...)
So in regards of compatibility with othe application it would not be a solution.Once more, many modern file managers (Total Commander etc) and download managers (ReGet etc.) work with descript.ion subsidiary files. BTW, either TC or ReGet are programms for advanced users, who know how to use their system options optimally, e.g. filenames.
Code: Select all
// Pfad zur descript.ion-Datei (anpassen falls nötig)
$descFile = "<curpath>\descript.ion";
// Datei Zeile für Zeile einlesen
$text = readfile($descFile);
$lines = tokenize($text, "<crlf>");
// Jede Zeile enthält: Dateiname Kommentar
foreach($line, $lines) {
// Dateiname und Kommentar trennen
// Hinweis: Wenn der Dateiname Leerzeichen enthält, ist er in Anführungszeichen
if (regexmatches($line, '^"(.+?)"\s+(.+)$')) {
$filename = regexreplace($line, '^"(.+?)"\s+(.+)$', '$1');
$comment = regexreplace($line, '^"(.+?)"\s+(.+)$', '$2');
} else {
// Kein Zitat → einfacher Dateiname
$filename = gettoken($line, 1, ' ');
$comment = trim(substr($line, strlen($filename)));
}
// Kompletter Pfad zur Datei
$filepath = "<curpath>\$filename";
// Nur wenn Datei existiert
if (exists($filepath) == 1) {
// Kommentar als XY-Kommentar speichern
tag "$comment", "$filepath", 2, 0;
}
}
// Speichern der tag.dat
#195; // save settings
text "Import abgeschlossen.", 64;
And ChatGPT produces bullshit, e.g.Multi-line Scripts and Multi-Scripts
A script can have more than one line (multi-line script), and a script resource can have more than one script (multi-script). There is one important formatting rule for multi-line scripts:
In a multi-line script all lines apart from the first line have to be indented by at least one space.
tokenize(). There isn't such a command...Code: Select all
// Initialize
$tabSearchOption = getkey("SearchResultsTab", "General");
// =0 -> Current tab
// =1|2|3 -> New tab
// Verwende das aktuelle Verzeichnis
$searchDir = <curpath>;
// Schritt 3: Prüfen, ob eine descript.ion-Datei im aktuellen Verzeichnis existiert
$descriptFile = "$searchDir\descript.ion";
if (exists($descriptFile) != 1) {
msg "Im aktuellen Verzeichnis wurde keine Datei 'descript.ion' gefunden. Das Script wird beendet.";
end true;
}
// Setze den Pfad der zu verarbeitenden Datei
$foundFiles = $descriptFile;
// Lies die Datei ein und bereite Inhalt auf
$content = readfile($foundFiles);
$content = replacelist($content, "<crlf>|<lf>|<cr>", "<crlf>", "<crlf>"); // vereinheitliche Zeilenenden
$content = regexreplace($content, "[\x00-\x1F]", ""); // Steuerzeichen entfernen
// Bereite für späteren Export vor
$newXYTags = "";
$tagsPerFile = "";
// Verarbeite jede Zeile
foreach($line, $content, "<crlf>") {
// Ignoriere leere Zeilen
if (trim($line) == "") { continue; }
// Prüfe, ob Name in Anführungszeichen
if (strpos($line, chr(34)) == 0) {
$name = trim(regexmatches($line, '^".*?"', ""), '"');
$comment = trim(regexreplace($line, '^".*?"\s*', ""));
} else {
$name = trim(regexmatches($line, '^[^\s]+', ""));
$comment = trim(regexreplace($line, '^[^\s]+\s*', ""));
}
// Konstruiere vollständigen Pfad zur Datei
$fullPath = $searchDir . "\" . $name;
// Optional: prüfen, ob Datei existiert
// if (!(exists($fullPath) == 1)) { continue; }
// Erzeuge Tag-Eintrag
$tagEntry = $fullPath . "|0|||||||" . $comment . "<crlf>";
$tagsPerFile = $tagsPerFile . $tagEntry;
}
// Sortiere und entferne Duplikate/leere Einträge
$newXYTags = formatlist($tagsPerFile, "ec", "<crlf>");
// Ausgabe oder Weiterverarbeitung (z.B. speichern)
msg "Folgende Tags wurden generiert:<crlf><crlf>" + $newXYTags;
// Backup der bestehenden tag.dat (automatisch mit Datum/Zeit)
copyas "tag_<datem yyyy-mm-dd_hh-nn-ss>.dat", "<xydata>", "<xydata>\\tag.dat";
// tag.dat einlesen und Kopfbereich extrahieren (alles bis 'Data:\r\n')
$curTagFileLeading = regexmatches(readfile("<xydata>\\tag.dat"), ".*?[\s\S]*Data:\r\n");
// Neue tag.dat zusammensetzen
$newTagDat = $curTagFileLeading . $newXYTags;
// tag.dat schreiben
writefile("<xydata>\\tag.dat", $newTagDat);
msg "Die Tags wurden erfolgreich in tag.dat gespeichert.<br><br>Bitte starte XYplorer neu, um die Änderungen zu sehen.";