Created
November 21, 2014 09:15
-
-
Save antonj/71abe6478cd4e7362b8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set aList to every file of entire contents of (choose folder with prompt "Please select directory.") whose name extension is "graffle" | |
-- set folderPath to POSIX path of (name of container of aFile) | |
(* | |
set aFolder to (choose folder with prompt "Please choose a file name") | |
set aList to items of aFolder whose name extension is "graffle" | |
*) | |
log aList | |
log "new stuff" | |
repeat with aFile in aList | |
set folderPath to (container of aFile) | |
log POSIX path of (folderPath as alias) | |
end repeat | |
end tell | |
tell application "OmniGraffle" | |
repeat with aFile in aList | |
tell application "Finder" to set folderPath to POSIX path of ((container of aFile) as alias) | |
set theFileName to name of aFile | |
set thePrefix to texts 1 thru ((offset of "." in theFileName) - 1) of theFileName | |
set aDestination to (folderPath & thePrefix & ".pdf") | |
log aDestination | |
open aFile | |
repeat 20 times -- wtf wait for document to open | |
try | |
set aDocument to document 1 | |
save aDocument in POSIX file aDestination with overwrite | |
close aDocument | |
exit repeat | |
on error | |
delay 1 | |
end try | |
end repeat | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment