Thank you very much serendipity..
Ermmm.. But actually what i've been looking for is for this script...
Code: Select all
/* CollectItems
v0.01.0003 2009.01.27 XY v7.90.0021 CJ v0.01.0004
+ "Edit Configuration File" now done directly inside XY
v0.01.0002 2009.01.15 XY v7.90.0021 CJ v0.01.0004
! Added setting to allow recursion!
v0.01.0001 2009.01.11 XY v7.90.0021 CJ v0.01.0003
+ Show All Collections : switched to HTML
v0.01.0000 2008.11.30 XY v7.90.0021 CJ v0.01.0001
+ first "new" release
*/
"_noSel"
global $XYS_name;
status "$XYS_name: No items selected !",,alert;
"[ ACTIVE ]"
-
"&Add Selected Items To Collection : AddToCollection"
sub _ensureXY;
sub (getinfo("CountSelected") > 0) ? "_addToCol" : "_noSel";
"_addToCol"
global $XYS_name, $CI_colname, $CI_list, $CI_collection;
self $base, base;
setting "AllowRecursion", 1;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
getkey $CI_collection, "$CI_colname", "Collections", "$base.ini";
replace $CI_list, report('{Fullname}|', 1), "[", "[[]"; // deal with brackets in filename
sub ($CI_list == "") ? "_nothing" : "_addSel";
setkey $CI_collection, "$CI_colname", "Collections", "$base.ini";
status "$XYS_name: Selected items added to ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""");
"_addSel"
global $CI_list, $CI_collection;
strpos $p, $CI_list, "|";
substr $item, $CI_list, 0, $p;
substr $CI_list, $CI_list, $p + 1;
//
strpos $p, $CI_collection, $item;
$CI_collection = ($p == -1) ? "$CI_collection$item|" : $CI_collection;
//
end ($CI_list == ""),,1;
sub _addSel;
"&Remove Selected Items From Collection : RemoveFromCollection"
sub _ensureXY;
sub (getinfo("CountSelected") > 0) ? "_remFromCol" : "_noSel";
"_remFromCol"
global $XYS_name, $CI_colname, $CI_list, $CI_collection;
self $base, base;
setting "AllowRecursion", 1;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
getkey $CI_collection, "$CI_colname", "Collections", "$base.ini";
replace $CI_list, report('{Fullname}|', 1), "[", "[[]"; // deal with brackets in filename
sub ($CI_list == "") ? "_nothing" : "_remSel";
setkey $CI_collection, "$CI_colname", "Collections", "$base.ini";
status "$XYS_name: Selected items removed from ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""");
"_remSel"
global $CI_list, $CI_collection;
strpos $p, $CI_list, "|";
substr $item, $CI_list, 0, $p;
substr $CI_list, $CI_list, $p + 1;
//
strpos $p, $CI_collection, $item;
strlen $l, $item;
substr $bef, $CI_collection, 0, $p;
substr $aft, $CI_collection, $p + $l + 1;
$CI_collection = ($p == -1) ? $CI_collection : "$bef$aft";
//
end ($CI_list == ""),,1;
sub _remSel;
-
"_noItemsInCollection"
global $XYS_name;
status "$XYS_name: No items found in collection",,stop;
msg "No items found in collection !";
"&Move Collected Items Here : MoveCollectedHere"
global $XYS_name, $CI_colname;
sub _ensureXY;
self $file, file;
self $path, path;
self $base, base;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
getkey $collection, "$CI_colname", "Collections", "$base.ini";
substr $collection, $collection, 0, -1;
replace $collection, $collection, "'", "''";
load (($collection == "") ? "load ""$file"", ""_noItemsInCollection"";" : "moveto ""<curpath>"", '$collection'; setkey """", ""$CI_colname"", ""Collections"", ""$path\$base.ini"";"),,s;
end $collection == "",,1;
status "$XYS_name: Items from ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""")." moved here";
"&Copy Collected Items Here : CopyCollectedHere"
global $XYS_name, $CI_colname;
sub _ensureXY;
self $file, file;
self $path, path;
self $base, base;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
getkey $collection, "$CI_colname", "Collections", "$base.ini";
substr $collection, $collection, 0, -1;
replace $collection, $collection, "'", "''";
load (($collection == "") ? "load ""$file"", ""_noItemsInCollection"";" : "copyto ""<curpath>"", '$collection';"),,s;
end $collection == "",,1;
status "$XYS_name: Items from ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""")." copied here";
"&Delete Collected Items : DeleteCollected"
global $XYS_name, $CI_colname;
sub _ensureXY;
self $file, file;
self $path, path;
self $base, base;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
getkey $collection, "$CI_colname", "Collections", "$base.ini";
substr $collection, $collection, 0, -1;
replace $collection, $collection, "'", "''";
load (($collection == "") ? "load ""$file"", ""_noItemsInCollection"";" : "delete 0, 1, '$collection'; setkey """", ""$CI_colname"", ""Collections"", ""$path\$base.ini"";"),,s;
end $collection == "",,1;
status "$XYS_name: Items from ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""")." deleted";
-
"&Edit Collection... : _EditCollection"
global $XYS_name, $CI_colname;
sub _ensureXY;
self $base, base;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
getkey $collection, "$CI_colname", "Collections", "$base.ini";
replace $collection, $collection, "|", <crlf>;
status "$XYS_name: Editing items in ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""");
input $collection, "Editing: " . (($CI_colname == "Active") ? "Active Collection" : "Collection ""$CI_colname"""), $collection, m;
replace $collection, $collection, <crlf>, "|";
setkey $collection, $CI_colname, "Collections", "$base.ini";
status "$XYS_name: ".(($CI_colname == "Active") ? "Active collection" : "Collection ""$CI_colname""")." saved";
"&Delete Collection... : DeleteCollection"
global $XYS_name, $CI_colname;
sub _ensureXY;
self $path, path;
self $base, base;
$CI_colname = ($CI_colname == "") ? "Active" : $CI_colname;
load ( (confirm("Do you want to delete the ".(($CI_colname == "Active") ? "active collection" : "collection ""$CI_colname""")." ?")) ? ('setkey "", "'.$CI_colname.'", "Collections", "'.$path.'\'.$base.'.ini"; status "'.$XYS_name.': '.(($CI_colname == "Active") ? "Active Collection" : "Collection """"$CI_colname""""").' deleted";') : 'call'),,s;
-
-
"[ GLOBAL ]"
"_global"
global $CI_script, $CI_flg;
self $path, path;
self $file, file;
self $base, base;
// getting the list of collections -- reading the INI
$data = readfile("$path\$base.ini");
strpos $p, $data, "[Collections]";
// going inside the list of collections
strpos $p, $data, <crlf>, $p;
// and assuming there's no more settings after!! (yeah, I know...)
substr $data, $data, $p + 2;
// putting all names on one line
regexreplace $data, $data, "\r", "";
regexreplace $data, $data, "\n", "/";
// and turning it into a selection-menu
regexreplace $data, $data, "(.+?)=.+?/", '"$1" global $CI_colname; $CI_colname = "$1"; load "'.$file.'", "'.$CI_script.'";'.<crlf>;
$data = ($data == "") ? """(no collections found)""<crlf>" : $data;
$data = $data . (($CI_flg == 1) ? "-<crlf>""Create new collection..."" load ""$file"", ""_createNewCollection""; <crlf>" : "");
load "$data<crlf>-<crlf>""<< Back"" load ""$file"",*;",,s;
"_createNewCollection"
global $XYS_name, $CI_colname, $CI_script;
self $base, base;
status "$XYS_name: Creating a new collection...",,progress;
$CI_colname = input("Enter the collection name",,"New Collection",,"::abort::"); // no, you can't name your collection "::abort::" Sucks, but that's life!
sub ($CI_colname == "::abort::") ? "_abortNewCollection" : "_nothing";
getkey $check, $CI_colname, "Collections", "$base.ini";
$check = ($check == "") ? 1 : confirm("There is already a collection ""$CI_colname"" -- Do you want to continue anyway ?");
// just to show a nice statusbar message instead of a popup...
sub ($check == 0) ? "_abortNewCollection" : "_nothing";
// ...in case we stop there
end ($check == 0),,1;
status "$XYS_name: Collection ""$CI_colname"" created";
sub $CI_script;
"_abortNewCollection"
global $XYS_name;
status "$XYS_name: Operation aborted, no collection created",,alert;
end 1;
-
"&Add Selected Items To A Collection... : AddToCollectionGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "AddToCollection";
$CI_flg = 1;
sub _global;
"&Remove Selected Items From A Collection... : _RemoveFromCollectionGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "RemoveFromCollection";
$CI_flg = 0;
sub _global;
"- : _sep"
"&Move Here Items From A Collection... : _MoveCollectedHereGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "MoveCollectedHere";
$CI_flg = 0;
sub _global;
"&Copy Here Items From A Collection... : _CopyCollectedHereGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "CopyCollectedHere";
$CI_flg = 0;
sub _global;
"&Delete Items From A Collection... : _DeleteCollectedGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "DeleteCollected";
$CI_flg = 0;
sub _global;
"- : _sep"
"&Edit A Collection... : _EditCollectionGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "_EditCollection";
$CI_flg = 1;
sub _global;
"&Delete A Collection... : _DeleteCollectionGlobal"
global $CI_script, $CI_flg;
sub _ensureXY;
$CI_script = "DeleteCollection";
$CI_flg = 0;
sub _global;
-
"&Show All Collections... : ShowAllCollections"
global $XYS_name, $CI_results, $CJ_tmp, $CJ_title, $CJ_html;
sub _ensureXY;
self $file, file;
self $path, path;
self $base, base;
$data = readfile("$path\$base.ini");
strpos $p, $data, "[Collections]";
strpos $p, $data, <crlf>, $p;
substr $data, $data, $p + 2;
regexreplace $data, $data, "\r", "";
regexreplace $data, $data, "\n", "/";
regexreplace $nb, $data, "(.+?)=.+?/", "+";
regexreplace $data, $data, "(.+?)=.+?/", 'global $CI_colname; $CI_colname = "$1"; load "'.$file.'", "_ListCollection"; ';
strlen $nb, $nb;
load (($nb == 0) ? ('status "'.$XYS_name.': No collections found",,stop; end 1, "No collections found !"; ') : $data),,s;
status "$XYS_name: Showing All Collections ($nb)";
$CJ_title = "$XYS_name: Showing All Collections ($nb)";
$CJ_html = $CI_results;
$CJ_tmp = "_ShowHTML";
sub _callCommonJacky;
$script = ($CJ_html == "") ? 'call' : urldecode($CJ_html);
load $script,,s;
"_ListCollection"
global $CI_results, $CI_colname;
self $base, base;
getkey $collection, "$CI_colname", "Collections", "$base.ini";
regexreplace $collection, "$collection", "(.+?)\|", "<li><a OnMouseover='window.status=""Click to browse to item""; return true;' OnMouseout=""window.status=''; return true;"" href='xys:goto ""$1"";'>$1</a></li>";
$CI_results = $CI_results . "<h2>".(($CI_colname == "Active") ? "Active Collection" : "Collection ""$CI_colname""")."</h2><ul>$collection</ul>";
-
-
"[ CollectItems ]"
-
"_ensureXY"
global $XYS_name, $XYS_file;
self $XYS_file, file;
getkey $XYS_name, "name", "Internal", $XYS_file;
getkey $xyreq, "requiredXY", "Internal", $XYS_file;
end (compare(<xyver>, $xyreq, v) >= 0),,1;
msg "WARNING: This version of $XYS_name requires XYplorer v$xyreq in order to work properly.<br><br>You are currently running an older version (<xyver>), are you sure you want to continue anyway ?<br><br>Note that this might lead to errors / unexpected results.", 1;
"&About CollectItems : About"
global $XYS_name, $CJ_tmp;
sub _ensureXY;
self $file, file;
self $path, path;
self $base, base;
getkey $curver, "version", "Internal", $file;
getkey $xyreq, "requiredXY", "Internal", $file;
getkey $cjreq, "requiredCJ", "Internal", $file;
getkey $cjver, "version", "Internal", "$path\common-jacky.xys";
status "$XYS_name: version $curver";
//
$data = readfile("$path\$base.ini");
strpos $p, $data, "[Collections]";
strpos $p, $data, <crlf>, $p;
substr $data, $data, $p + 2;
regexreplace $data, $data, "\r", "";
regexreplace $data, $data, "\n", "/";
regexreplace $nb, $data, "(.+?)=.+?/", "+";
regexreplace $data, $data, "(.+?)=.+?/", "$1, ";
strlen $nb, $nb;
substr $data, $data, 0, -2;
$list = ($nb == 0) ? "No collections yet." : (($nb == 1) ? "One collection: $data" : "$nb collections: $data");
//
$CJ_tmp = "_getXyauState";
sub _callCommonJacky;
$CJ_tmp = ($CJ_tmp == "_getXyauState") ? "Unable to get XYplorer Automatic Updater integration state -- requires common-jacky.xys" : $CJ_tmp;
//
msg "$XYS_name -- version $curver<br>Requires XYplorer $xyreq (Running: <xyver>)<br>Requires common-jacky $cjreq".(($cjver == '') ? ' (Not Found!)' : " (Running $cjver)")."<br><br>This script: $file<br>Configuration: $path\$base.ini<br><br>$list<br><br>$CJ_tmp";
load *;
"Change&log of CollectItems : _AutoChangelog"
global $CJ_tmp;
sub _ensureXY;
$CJ_tmp = "_AutoChangelogHTML";
sub _callCommonJacky;
load *;
"&Edit Configuration File... : _EditINI"
global $XYS_name;
sub _ensureXY;
self $path, path;
self $base, base;
$file = "$path\$base.ini";
status "$XYS_name: Editing $file",,progress;
status writefile($file, input("$XYS_name: Editing Configuration File",,readfile($file), w,,800, 600)) ? "$XYS_name: File saved" : "$XYS_name: Error writing file";
"- : _sep"
"Chec&k for updates of CollectItems... : _CheckForAutoUpdates"
global $CJ_tmp;
sub _ensureXY;
$CJ_tmp = "_CheckForAutoUpdates";
sub _callCommonJacky;
load *;
"&Install CollectItems support in XYplorer Automatic Updater... : _InstallInXYAU"
global $CJ_tmp;
sub _ensureXY;
$CJ_tmp = "_InstallInXYAU";
sub _callCommonJacky;
load *;
"_callCommonJacky"
global $CJ_tmp;
self $file, file;
self $path, path;
getkey $cj_req, "requiredCJ", "Internal", $file;
getkey $cj_ver, "version", "Internal", "common-jacky.xys";
end $cj_ver == "", ($CJ_tmp == '_getXyauState') ? '' : "In order to accomplish the desired operation, you need to have the ""library"" common-jacky.xys installed -- Please download the script file and put it in the same folder as this script file ($path\).", 1;
end (compare($cj_ver, $cj_req, v) == -1), "In order to accomplish the desired operation, you need to have the ""library"" common-jacky.xys v$cj_req or more installed, your current version is v$cj_ver -- Please update to the latest version.", 1;
load "common-jacky", "$CJ_tmp";
-
"Show &Full Menu... : ShowFullMenu"
load *,*;
"Show Standard &Menu... : _ShowMenu"
load *;
"Cancel : nothing"
"_nothing"
"_settings"
[Internal]
name="CollectItems"
version="0.01.0003"
requiredXY="7.90.0021"
requiredCJ="0.01.0004"
Url="http://88.191.26.34/XYscripts/download/"
If I'm not mistaken, last time, it was from you who introduced me the script above, don't you?
Anyway, your script is neat and simple. It's just that I don't like the idea of having to select the final output folder via pop-up window instead of the normal paste into the current open folder. Don't you think so?
Thank you.