{"id":299,"date":"2008-08-24T08:24:22","date_gmt":"2008-08-24T15:24:22","guid":{"rendered":"http:\/\/strawhousepig.net\/wp\/?p=299"},"modified":"2008-08-24T08:24:22","modified_gmt":"2008-08-24T15:24:22","slug":"export-image-for-selected-address-book-card","status":"publish","type":"post","link":"https:\/\/strawhousepig.net\/wordpress\/2008\/08\/24\/export-image-for-selected-address-book-card\/","title":{"rendered":"Export image for selected Address Book card"},"content":{"rendered":"<p>An AppleScript that will export the image file associated with an entry in Address Book.<br \/>\n<!--more--><br \/>\nThere is no error handling, so if you have multiple (or zero) cards selected, or a card with no image, nothing will let you know it didn&#8217;t work.<\/p>\n<p>Also, the ideal way to launch this script would be from Address Book&#8217;s script folder ( ~\/Library\/Scripts\/Applications\/Address Book ).<\/p>\n<pre>set tmp_image to ((path to temporary items folder as text) & \"tmp AB\") as string\ntell application \"Address Book\"\n\tactivate\n\tset this1 to selection as reference\n\tset file_name to name of this1\n\tset the_image to image of this1\n\ttry\n\t\tset AB_image to (open for access tmp_image with write permission)\n\t\tset eof AB_image to 0\n\t\twrite the_image to AB_image\n\t\tclose access AB_image\n\ton error\n\t\tclose access AB_image\n\tend try\n\tset the_image to \"\"\n\tset the_file to choose file name with prompt \"Save as\" default name file_name & \" AB image.tiff\"\nend tell\ntell application \"Image Events\"\n\tset this_image to open (tmp_image) as string\n\tset the_file to the_file as string\n\tsave this_image in the_file as TIFF\n\tclose this_image\nend tell<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>An AppleScript that will export the image file associated with an entry in Address Book.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[10,28],"class_list":["post-299","post","type-post","status-publish","format-standard","hentry","category-code","tag-applescript-2","tag-os-x"],"_links":{"self":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/299","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=299"}],"version-history":[{"count":0,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/299\/revisions"}],"wp:attachment":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}