We have a client that sends 90% of their work in as Freehand files. We are looking for ways to automate a workflow for them but this will require some AS scripting to work with a third party workflow automation software package.
Here are my challenges:
About 20% of the supplied Freehand files are FH9 and need to be converted to FH11. I have a script which does this successfully.
FH11 files need to be exported to EPS. I have a script which will successfully accomplishes this task also, but it contains some unnecessary elements, some apparently redundant steps and produces 1 unwanted result - I need the filename to be 8 characters plus extension but I get 8 characters + .FH11 + .EPS. It also does not do some things that I would like it to do (See below).
As far as the automated workflow is concerned, here is what needs to happen:
A batch of folders containing FH (mix of FH9 and FH11) files is dropped onto a hot folder - FH9 files are identified and converted to FH11. The whole batch is then passed on to the next step where EPS files are exported from all the FH11 files. All these files contain multiple layers with very strict naming conventions. My problem lies in that some may be missing a necessary layer (always named “DC”) and these need to be set aside for some manual intervention. There is also a layer (always name “Do Not Print”) which I need to appear in the EPS, but it is set as non-printing.
The hot folders used for this process will be static, so I would like to hard code original and destination locations into the script. I am an absolute AS newbie and need some help with this one.
Here is the convert to FH11 script.
on open x
with timeout of 14400 seconds
tell application "Finder"
set droppedFiles to count x
repeat with cnter from 1 to droppedFiles
set currentfile to item cnter of x
copy (file type of file currentfile) to crCheck
if characters 1 thru 3 of crCheck as string is equal to "FHD" then
beep 1
display dialog "FreeHand MX cannot open v2 or v3 FreeHand files. " & ¬
"Please use the FreeHand 8 conversion script " & ¬
"with FreeHand 8 to convert those file types. " & return & return & ¬
"" buttons "OK" default button 1
else
if characters 1 thru 3 of crCheck as string is equal to "AGD" then
saveas11files(currentfile) of me
else
beep 1
end if
end if
end repeat
end tell
end timeout
end open
on saveas11files(currentfile)
tell application "FreeHand MX"
open currentfile with Dialogs
set currentfile to currentfile as string
set AppleScript's text item delimiters to {":"}
set currentDir to ((text items 1 through -2 of currentfile) as string) & ":"
set filename to ((last text item of currentfile) as string)
if length of (filename as string) is greater than 8 then
set filename to (text 1 thru 8 of filename) as string
set newFile to (currentDir & filename) as string
set currentfile to currentfile as alias
else
set newFile to currentfile as alias
set currentfile to currentfile as alias
end if
set AppleScript's text item delimiters to {}
set fileExtension to {"FH11"}
set newName to (newFile as string) & "." & fileExtension
save last document in file newName
close last document
end tell
end saveas11files
I don’t need the warning regarding FH 8 files.
Here is the export as EPS script:
on open x
with timeout of 14400 seconds
tell application "Finder"
try
set originFolder to choose folder with prompt "Where do you want to save your EPS files?"
on error
beep
display dialog ¬
"You must have Navigation Services installed " & ¬
"to run this script." buttons {"Cancel"} ¬
default button "Cancel"
end try
set withEPS to true
set droppedFiles to count x
repeat with cnter from 1 to droppedFiles
set currentfile to item cnter of x
copy (file type of file currentfile) to crCheck
if characters 1 thru 3 of crCheck as string is equal to "FHD" then
beep 1
display dialog "FreeHand MX cannot open v2 or v3 FreeHand files. " & ¬
"Please use the FreeHand 8 conversion script " & ¬
"with FreeHand 8 to convert those file types. " & return & return & ¬
"" buttons "OK" default button 1
else
if characters 1 thru 3 of crCheck as string is equal to "AGD" then
if withEPS then
exportfh11files2(currentfile, originFolder) of me
else
exportfh11files(currentfile, originFolder) of me
end if
else
beep 1
end if
end if
end repeat
end tell
end timeout
end open
on exportfh11files(currentfile, originFolder)
tell application "FreeHand MX"
open currentfile with Dialogs
set currentfile to currentfile as string
set AppleScript's text item delimiters to {":"}
set currentDir to ((text items 1 through -2 of currentfile) as string) & ":"
set filename to ((last text item of currentfile) as string)
if length of (filename as string) is greater than 8 then
set filename to (text 1 thru 8 of filename) as string
set newFile to (currentDir & filename) as string
set currentfile to currentfile as alias
else
set newFile to currentfile as alias
set currentfile to currentfile as alias
end if
set EPS_Location to originFolder & currentfile & ".eps" as string
save last document as MacEPS in file EPS_Location with IncludeFHDocInEPS
close last document
end tell
end exportfh11files
on exportfh11files2(currentfile, originFolder)
tell application "FreeHand MX"
open currentfile with Dialogs
set currentfile to currentfile as string
set AppleScript's text item delimiters to {":"}
set currentDir to ((text items 1 through -2 of currentfile) as string) & ":"
set filename to ((last text item of currentfile) as string)
if length of (filename as string) is greater than 8 then
set filename to (text 1 thru 8 of filename) as string
set newFile to (currentDir & filename) as string
set currentfile to currentfile as alias
else
set newFile to currentfile as alias
set currentfile to currentfile as alias
end if
set EPS_Location to originFolder & currentfile & ".eps" as string
save last document as MacEPS in file EPS_Location with IncludeFHDocInEPS
close last document
end tell
end exportfh11files2
I don’t need the warning regarding FH 8 files and all files should contain the FH document in the EPS. I would like to turn all layers to printing layers, send all good files to one static location and bounce any files that do not contain a layer named “DC” to a problem files folder.
Can this be simplified? Done all in one script? Are the steps regarding the layers easily accomplished?
Thanks in Advance,
Lunarlandr