Am sure this is going to be impossible but I want to be able to select a folder of MacDraft files and run an applescript that goes through each file and opens it and saves it as the same name but as a PDF. Ideally it would go through sub folders and do the same too. I am a little familiar with AS but have been unable to get it to work…Anyone out there able to help?
I don’t have MacDraft, so I can’t answer any specifics, but I can help you with one thing…
One interesting thing about handlers in AppleScript is that they can call themselves. This makes it easy to recurse through a folder hierarchy. This code is handy and everyone should keep a copy for when it’s needed.
set the_folder to (choose folder)
repeat with i from 1 to the count of the_folder
set this_item to (item i of the_folder)
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
end if
process_item(this_item)
end repeat
on process_folder(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
end if
process_item(this_item)
end repeat
end process_folder
on process_item(this_item)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
end process_item
You can find this and other handlers (also called subroutines) at Essential Subroutines on Apple’s website.
Thanks Dennis,
Thats useful code to keep in the bag - I kinda wish you had had a copy of MD cos now I feel like I am 75% there and close enough to smell the coffee but not taste it - grrrr!
Post what you have and maybe we can see if it’s something syntactical that’s holding you up.
What does the MD dictionary look like? Is there anything in there that could help you out?