Shorting Script

I have a script that makes a bunch of different Indesign docs based off some user inputs. I was wondering if there is a way to shorten some of the same fuctions. Each doc is the same size (8.5 X 11) the only things that will change are the point size, fill color, applied font, geometric bounds and the save name.

any ideas this script is huge…

tell application "Adobe InDesign CS2"
		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
				set LayerName to layer "Image layer" of FormDoc
			on error
				set LayerName to make layer with properties {visible:true, locked:false, name:"GAME ID"}
				delete layer 2
			end try
			delete color "C=100 M=0 Y=0 K=0"
			delete color "C=0 M=0 Y=100 K=0"
			delete color "C=0 M=100 Y=0 K=0"
			delete color "C=15 M=100 Y=100 K=0"
			delete color "C=75 M=5 Y=100 K=0"
			delete color "C=100 M=90 Y=10 K=0"
			set the_frame to make text frame
			set the geometric bounds of the_frame to {"10.7861 in", "0 in", "11 in", "4.4972 in"}
			set contents of the_frame to gamename & " " & (do shell script "date +%m/%y")
			set vertical justification of text frame preferences to bottom align
			set justification of characters of the_frame to left align
			set applied font of characters of the_frame to "Helvetica (TT)"
			set font style of characters of the_frame to "Bold"
			set point size of characters of the_frame to 16
			set fill color of characters of the_frame to "Registration"
			set overprint fill of characters of the_frame to true
			set vertical justification of text frame preferences of the_frame to bottom align
			set capitalization of characters of the_frame to all caps
			set save_name to "GAME ID" as string
			set dest_path to gamefolder as string
			set FileName to dest_path & save_name
			save to FileName
		end tell
		close active document
	end tell



There’s a distinct difference between, shortening (making shorter, not like Crisco :P) and optimizing. If you’re talking about shortening the script, the first thing I would do is concatenate lines. It won’t make your script faster, and often makes a script harder to follow, but it will make it shorter.

For example, in your script…
set page width to “8.5 in”
set page height to “11 in”

could be…
set {page height, page width} to {“8.5 in”,“11”}

It might takes some fiddlin’ around at first but I actually use this type of syntax all the time. My scripts are not usually for public view so I make them as brief as I can. (It’s on OCD thing :lol:)

Have fun,
Jim Neumann

oops typo…

Thanks for the suggestion, I thought it would speed it up a bit, but if not I don’t mind the length, like you said it is easier to follow.