Catalog item to create zip from selected files
Catalog item to create zip from selected files
Is there an easy way to create a catalog item to create a zip file by dragging files onto it? Ideally, it would prompt for a file name, but if I could set one by default, that would be fine as well.
Re: Catalog item to create zip from selected files
Sure, script it.
an entry in the catalog.
get("drop")
contains the items that are dragged overan entry in the catalog.
One of my scripts helped you out? Please donate via Paypal
Re: Catalog item to create zip from selected files
Please excuse my n00bness, but not exactly sure how to set this up. Any additional info would be VERY welcomed!
[UPDATE] I found your post with the script below
and it seems to work, but is there a way to do it without any dialog?
[UPDATE] I found your post with the script below
Code: Select all
$zip = "<path to 7-zip>\7zG.exe";
$sel = quote(get("SelectedItemsPathNames", '" "'));
$cnt = get("CountSelected");
if ($cnt > 1) { $zipName = "<curpath>\" . trim(gpc(<curpath>, "base"), ":", "R") . ".7z"; }
elseif ($cnt == 1) { $zipName = gpc(<curitem>, "base") . ".7z"; }
else { status "No item(s) selected, aborted!", "8B4513", "stop"; end true; }
run """$zip"" a ""$zipName"" -ad $sel", , 0, 1;
Re: Catalog item to create zip from selected files
What dialog? 7z's? There is
dragging but by selected items (if this makes a difference...)
zip_add()
. And that script doesn't work bydragging but by selected items (if this makes a difference...)
One of my scripts helped you out? Please donate via Paypal
Re: Catalog item to create zip from selected files
My mistake. Disregard the 7zip script.
Re: Catalog item to create zip from selected files
Back to the original ask, I added the
get("drop")
script, but it doesn't seem to actually do anything.Re: Catalog item to create zip from selected files
Code: Select all
$items = <get drop |>;
$name = input("Enter .zip file name", ".zip will be added automatically!", gpc(gettoken($items, 1, "|"), "base"));
if (substr($name, -4) UnLikeI ".zip") { $name .= ".zip"; }
zip_add("<curpath>\$name", $items);
One of my scripts helped you out? Please donate via Paypal
Re: Catalog item to create zip from selected files
Perfect! Many thanks!