{"id":894,"date":"2020-11-30T11:44:02","date_gmt":"2020-11-30T18:44:02","guid":{"rendered":"http:\/\/10.0.1.201\/?p=894"},"modified":"2025-12-01T11:38:06","modified_gmt":"2025-12-01T18:38:06","slug":"zip-droplet","status":"publish","type":"post","link":"https:\/\/strawhousepig.net\/wordpress\/2020\/11\/30\/zip-droplet\/","title":{"rendered":"Zip droplet"},"content":{"rendered":"\n<p><ins datetime=\"2021-08-20T22:02:06+00:00\">This has been some hot garbage since I posted it. This is now actually not bad, but I can&#8217;t help but feel it&#8217;s clumsier than it could be. *meh*<\/ins><\/p>\n\n\n\n<p>Quick and dirty AppleScript droplet to zip files in the Finder.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- http:\/\/strawhousepig.net\/\n\n-- This will not send files beginning with '.' (dot) to be zipped.\n\nproperty def_loc : path to desktop\n(*\nIf you're going to be sending zip archives to a location other than\na file-system domain (directories which the system has a 'nickname' for)\n I believe the above syntax would be:\n\tpath to file \"My HD:My Folder Daryl:My Other Folder Daryl:\"\nOr using POSIX style path\n\tpath to POSIX file \"\/My HD\/My Folder Daryl\/My Other Folder Daryl\/\"\nAlthough I am not sure about that. Another alternative would be to add an\nif clause in the zip_it function to check for the \"same\" setting and then\nuse the container of item 1 of the files list \"_it\" as the default location.\n*)\n\n-- Not quite sure how to use this, in the AS routines or 'zip -x' or screw it and skip all files beginning with a dot?\n--property no_can_zip : {\".DS_Store\", \".fseventsd\", \".Spotlight-V100\"}\n\non run\n\ttell application \"Finder\"\n\t\tset _it to selection as list\n\tend tell\n\tmy zip_it(_it)\nend run\n\non open _it\n\tzip_it(_it)\nend open\n\non zip_it(_it)\n\tset _f to \"\"\n\ttell application \"Finder\" to set _dir to container of ((item 1 of _it) as alias)\n\tset my text item delimiters to {POSIX path of (_dir as alias)}\n\trepeat with i in _it\n\t\tif first character of name of (info for (i as alias)) is not \".\" then\n\t\t\tset _f to _f &amp; \" \" &amp; quoted form of text item 2 of (POSIX path of (i as alias))\n\t\tend if\n\tend repeat\n\tset the_c to count of _it\n\tif the_c > 1 then\n\t\tset z_name to (displayed name of (info for (item 1 of _it as alias))) &amp; \" + \" &amp; (the_c - 1) &amp; \" items.zip\"\n\telse\n\t\tset z_name to (displayed name of (info for (item 1 of _it as alias))) &amp; \".zip\"\n\tend if\n\tset _z to (choose file name with prompt (the_c as string) &amp; \" item(s) to zip.\" default name z_name default location (_dir as alias))\n\tdo shell script \"cd \" &amp; quoted form of POSIX path of (_dir as alias) &amp; \" &amp;&amp; zip  -ry \" &amp; quoted form of POSIX path of _z &amp; _f\nend zip_it\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This has been some hot garbage since I posted it. This is now actually not bad, but I can&#8217;t help but feel it&#8217;s clumsier than it could be. *meh* Quick and dirty AppleScript droplet to zip files in the Finder.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-894","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/comments?post=894"}],"version-history":[{"count":3,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/894\/revisions"}],"predecessor-version":[{"id":1076,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/894\/revisions\/1076"}],"wp:attachment":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}