Has anybody ever encountered an error in scripting Indesign CS2. I’m running OS X 10.3.9. The script works fine in on a mac running Panther and I also tried it on another mac running 10.3.9 and it worked on that mac also. So now I figure it has to be my machine, but I can not figure out why. I run the script, it builds the page and when it goes to save the file it crashes and gives me an error “Connection is Invalid”. If anyone can help me out here or shed some light on my situation that would be great. Thanks in advance.
Here is a sample of the Script…
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 at SaveFolder with properties {name:inset_number}
------------------------------------------------------
set SpotColor1 to characters 2 thru 3 of inset_number as text
end tell
end
----------------------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
tell WinFormFrame
set the geometric bounds to {"10.8438 in", "0 in", "11 in", "1.5 in"}
set contents to "WIN FORM #" & inset_number
set the label to "WinFormFrame"
end tell
tell text frame preferences of WinFormFrame
set vertical justification to bottom align
end tell
tell paragraphs of WinFormFrame
set justification to left align
set applied font to "Helvetica (TT)"
set font style to "Bold"
set point size to 12
set fill color to NewSpotColor
set overprint fill to true
set leading 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