This script is driving me crazy. I’m still new to this but learning quick. I have this script that works if I take part of it out. The piece I take out should not effect the saving of the file but it does???
Here it is:
tell application "Finder"
set SaveFolder to (choose folder name with prompt "Select Folder to Save Impo Files")
------------------------------------------------------
set inset_number to text returned of (display dialog "Enter the Inset Number" default answer "000") as string
make new folder in SaveFolder with properties {name:inset_number}
------------------------------------------------------
set SpotColor1 to characters 2 thru 3 of inset_number as text
end tell
----------------------Create Form File--------------------------------
tell application "Adobe InDesign CS2"
activate
set FormDoc to make document
tell document preferences of FormDoc
set page width to "8.5 in"
set page height to "11 in"
end tell
tell FormDoc
try
set LayerName to layer "Image layer" of FormDoc
on error
set LayerName to make layer with properties {visible:true, locked:false, name:inset_number}
delete layer 2
end try
set NewSpotColor to make color with properties {space:CMYK, color value:{0, 0, 0, 100}, name:SpotColor1}
set properties of NewSpotColor to {model:spot}
set WinFormFrame to make text frame with properties {geometric bounds:{"10.8438", "0", "11", "1.5"}, contents:"WIN FORM #" & inset_number}
tell WinFormFrame
set vertical justification of text frame preferences to bottom align
set justification of paragraphs to left align
set applied font of paragraphs to "Helvetica (TT)"
set font style of paragraphs to "Bold"
set point size of paragraphs to 12
set fill color of paragraphs to NewSpotColor
set overprint fill of paragraphs to true
set leading of paragraphs to auto
end tell
set save_name to "FORM " & inset_number as string
set dest_path to SaveFolder & inset_number & ":" as string
set myFileName to dest_path & save_name
save to myFileName
end tell
close active document
end tell
Once I take this part out it works…
tell WinFormFrame
set vertical justification of text frame preferences to bottom align
set justification of paragraphs to left align
set applied font of paragraphs to "Helvetica (TT)"
set font style of paragraphs to "Bold"
set point size of paragraphs to 12
set fill color of paragraphs to NewSpotColor
set overprint fill of paragraphs to true
set leading of paragraphs to auto
end tell
tell application "Finder"
set SaveFolder to (choose folder name with prompt "Select Folder to Save Impo Files")
------------------------------------------------------
set inset_number to text returned of (display dialog "Enter the Inset Number" default answer "000") as string
make new folder in SaveFolder with properties {name:inset_number}
------------------------------------------------------
set SpotColor1 to characters 2 thru 3 of inset_number as text
end tell
----------------------Create Form File--------------------------------
tell application "InDesign CS"
activate
set FormDoc to make document
tell document preferences of FormDoc
set page width to "8.5 in"
set page height to "11 in"
end tell
tell FormDoc
try
set LayerName to layer "Image layer" of FormDoc
on error
set LayerName to make layer with properties {visible:true, locked:false, name:inset_number}
delete layer 2
end try
set NewSpotColor to make color with properties {space:CMYK, color value:{0, 0, 0, 100}, name:SpotColor1}
set properties of NewSpotColor to {model:spot}
set WinFormFrame to make text frame with properties {geometric bounds:{"10.8438 in", "0 in", "11 in", "1.5 in"}, contents:"WIN FORM #" & inset_number}
tell WinFormFrame
set vertical justification of text frame preferences to bottom align
set justification of paragraphs to left align
set applied font of paragraphs to "Helvetica (T1)"
set font style of paragraphs to "Bold"
set point size of paragraphs to 12
set fill color of paragraphs to NewSpotColor
set overprint fill of paragraphs to true
set leading of paragraphs to -1
end tell
set save_name to "FORM " & inset_number as string
set dest_path to SaveFolder & inset_number & ":" as string
set myFileName to dest_path & save_name
save to myFileName
end tell
close active document
end tell
I have made a few minor changes, basically specifying the dimensions in making WinFormFrame to inches, your default measure is probably picas or points, so it’s building a text box large enough or in the right area. Never assume when it comes to what measuremet unit the document is using, I always set them to points for easy math. Second I changed the font to Helvetica type 1 because that is what I have loaded. And last to set the leading to auto you need to use -1 rather than auto, but I don’t know that this is neccessary for what your doing and would be tempted to take it out altogether.
Jerome Thanks for the try. It is still giving me problems. Indesign CS2 crashes when try to save the document. Telling me that the “connection is invalid” I’m running OS X 10.3.9 here at work. I take the script home where I’m running tiger and it works great. Maybe Panther has something to do with it.
I’m on 10.3.9 here at home, but have not noticed much difference. Did you compile it on the Tiger computer? I noticed that my script to mount volumes was acting flaky on Tiger at work, opened it and recompiled, saved it and that seems to fix it. Are you saving onto a network (mounted volume) or your main HD? If the former, try saving to your HD there could be a problem with the network communication.
I took youe edited version of the script and compiled it on my mac here at work and I’m still getting the same error. I keep trying different variations on the save command but with no luck. This seems to be a fairly simple script, I just can’t figure why this is happening.
Runs fine on my computer under 10.3.9 and InDesign CS. I would have to go into work to try in on a system similar to yours, but I’m working at home today. If I have time Tuesday I will try it and see if it works.
Jerome
I copied the script tp another computer in my department running the same OS and software and it worked fine. So now I have to figure out why it won’t work on mine. I never had this problem before. I have written several scripts at work and they work fine on my system and any other I put them on. This is wierd.