{"id":172,"date":"2008-05-20T11:13:53","date_gmt":"2008-05-20T17:13:53","guid":{"rendered":"http:\/\/www.cortig.net\/wordpress\/?p=172"},"modified":"2008-05-20T12:38:25","modified_gmt":"2008-05-20T18:38:25","slug":"second-version-of-the-office-2008-converter-script","status":"publish","type":"post","link":"https:\/\/www.cortig.net\/wordpress\/2008\/05\/20\/second-version-of-the-office-2008-converter-script\/","title":{"rendered":"Second version of the Office 2008 converter script"},"content":{"rendered":"<p>Well Steve Maser asked me to come up with a version that would work recursively on all files inside a folder you would drag to the script.<br \/>\nHe also suggested that I added the W6BN type (for Word 6\/95 files).<br \/>\nSo I based the script on <a href=\"http:\/\/www.apple.com\/applescript\/sbrt\/sbrt-10.html\">one of the examples provided by Apple<\/a>, and here is the result:<\/p>\n<p><code>-- This droplet processes files dropped onto the applet<br \/>\non open these_items<br \/>\n&nbsp;&nbsp;&nbsp;repeat with i from 1 to the count of these_items<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set this_item to item i of these_items<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set the item_info to info for this_item<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if folder of the item_info is true then<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;process_folder(this_item)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tell application \"Finder\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- get the file type<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set TheFileType to file type of this_item<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set UpdatedFileType to TheFileType<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- detect old file types for Office files chose the correct one instead<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if TheFileType = \"WDBN\" then set UpdatedFileType to \"W8BN\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if TheFileType = \"W6BN\" then set UpdatedFileType to \"W8BN\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if TheFileType = \"XLS4\" then set UpdatedFileType to \"XLS8\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;if TheFileType = \"SLD8\" then set UpdatedFileType to \"SLD8\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- set the new file type<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set file type of this_item to UpdatedFileType<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end tell<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if<br \/>\n&nbsp;&nbsp;&nbsp;end repeat<br \/>\nend open<br \/>\n-- Just in case people try to open the script through a double-click in the Finder.<br \/>\non run<br \/>\n&nbsp;&nbsp;&nbsp;display dialog \"Drop your files or folders to be converted on this icon\"<br \/>\nend run<\/p>\n<p>-- this sub-routine processes folders<br \/>\non process_folder(this_folder)<br \/>\n&nbsp;&nbsp;&nbsp;set these_items to list folder this_folder without invisibles<br \/>\n&nbsp;&nbsp;&nbsp;repeat with i from 1 to the count of these_items<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set this_item to alias ((this_folder as Unicode text) & (item i of these_items))<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set the item_info to info for this_item<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if folder of the item_info is true then<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;process_folder(this_item)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tell application \"Finder\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- get the file type<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set TheFileType to file type of this_item<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set UpdatedFileType to TheFileType<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- detect old file types for Office files chose the correct one instead<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if TheFileType = \"WDBN\" then set UpdatedFileType to \"W8BN\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if TheFileType = \"W6BN\" then set UpdatedFileType to \"W8BN\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if TheFileType = \"XLS4\" then set UpdatedFileType to \"XLS8\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;if TheFileType = \"SLD8\" then set UpdatedFileType to \"SLD8\"<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- set the new file type<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set file type of this_item to UpdatedFileType<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end tell<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if<br \/>\n&nbsp;&nbsp;&nbsp;end repeat<br \/>\nend process_folder<\/p>\n<p><\/code><\/p>\n<p><a href=\"http:\/\/www.cortig.net\/files\/Office_File_Type Converter_v2.zip\">The compiled script is here<\/a> and again, please make tests only on a copy of your files.<br \/>\nFeedbacks are much welcome.<\/p>","protected":false},"excerpt":{"rendered":"<p>Well Steve Maser asked me to come up with a version that would work recursively on all files inside a folder you would drag to the script. He also suggested that I added the W6BN type (for Word 6\/95 files). So I based the script on one of the examples provided by Apple, and here is the result: &#8212; This droplet processes files dropped onto the applet on open these_items &nbsp;&nbsp;&nbsp;repeat with i from 1 to the count of these_items &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set this_item to item i&hellip;<\/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-172","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/posts\/172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":0,"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cortig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}