InDesign - Path Points - Entire Path - Question

Hello all,

I am able to read points and bezier points in illustrator and then capture that data into a variable in order to use as part of a script.
To get the path data I use this:


tell application "Adobe Illustrator"
	return entire path of path item 1 of document 1
end tell

and it returns:


{{class:path point info, anchor:{290.384765625, 62.0703125}, left direction:{290.384765625, 62.0703125}, right direction:{290.384765625, 62.0703125}, point type:corner}, {class:path point info, anchor:{296.830078125, 62.0703125}, left direction:{296.830078125, 62.0703125}, right direction:{296.830078125, 62.0703125}, point type:corner}, {class:path point info, anchor:{297.501953125, 65.1142578125}, left direction:{297.501953125, 65.1142578125}, right direction:{297.501953125, 65.1142578125}, point type:corner}, {class:path point info, anchor:{290.921875, 65.1142578125}, left direction:{290.921875, 65.1142578125}, right direction:{290.921875, 65.1142578125}, point type:corner}, {class:path point info, anchor:{291.99609375, 71.33642578125}, left direction:{291.99609375, 71.33642578125}, right direction:{291.99609375, 71.33642578125}, point type:corner}, {class:path point info, anchor:{289.41015625, 71.33349609375}, left direction:{289.41015625, 71.33349609375}, right direction:{289.41015625, 71.33349609375}, point type:corner}, {class:path point info, anchor:{289.3984375, 71.27001953125}, left direction:{289.3984375, 71.27001953125}, right direction:{289.3984375, 71.28515625}, point type:corner}, {class:path point info, anchor:{289.396484375, 71.31201171875}, left direction:{289.3984375, 71.2978515625}, right direction:{287.89453125, 65.90673828125}, point type:corner}, {class:path point info, anchor:{282.98046875, 64.60107421875}, left direction:{283.58203125, 64.73876953125}, right direction:{282.98046875, 64.60107421875}, point type:corner}, {class:path point info, anchor:{282.908203125, 64.60107421875}, left direction:{282.908203125, 64.60107421875}, right direction:{282.908203125, 64.60107421875}, point type:corner}, {class:path point info, anchor:{282.37109375, 62.0703125}, left direction:{282.37109375, 62.0703125}, right direction:{282.37109375, 62.0703125}, point type:corner}, {class:path point info, anchor:{286.35546875, 62.0703125}, left direction:{286.35546875, 62.0703125}, right direction:{286.35546875, 62.0703125}, point type:corner}, {class:path point info, anchor:{284.384765625, 50.833984375}, left direction:{284.384765625, 50.833984375}, right direction:{283.712890625, 47.0263671875}, point type:corner}, {class:path point info, anchor:{288.998046875, 44.65625}, left direction:{286.087890625, 44.65625}, right direction:{290.0703125, 44.65625}, point type:smooth}, {class:path point info, anchor:{291.458984375, 45.193359375}, left direction:{290.875, 44.833984375}, right direction:{291.458984375, 45.193359375}, point type:corner}, {class:path point info, anchor:{292.265625, 48.728515625}, left direction:{292.265625, 48.728515625}, right direction:{291.591796875, 48.19140625}, point type:corner}, {class:path point info, anchor:{290.384765625, 48.05859375}, left direction:{291.146484375, 48.05859375}, right direction:{289.130859375, 48.05859375}, point type:smooth}, {class:path point info, anchor:{288.4140625, 50.5654296875}, left direction:{288.146484375, 48.998046875}, right direction:{288.4140625, 50.5654296875}, point type:corner}}

I would like to do this in InDesign and I am having trouble figuring out the code.

My goal is to add functionality to my crop mark script to add my logo at the bottom of the page without having to copy and paste and manually position. Since my logo is all vector, if I could capture the path values, I could simple make a new object with those values (this would circumvent the need for copy paste).

Any suggestions would be greatly appreciated!

Thanks

Ok I got some of what I want to do working…

The following code works for a none compound letter (i.e. the letter F) but doesn’t work for a compound letter such as the letter lower case “e”

any ideas?


tell application "Adobe InDesign CS3"
	set myPathPoints to properties of path 1 of selection of document 1
	tell document 1
		set myPolygon to make polygon
		set entire path of path 1 of myPolygon to entire path of myPathPoints
	end tell
end tell

Hi,

Compound paths are composed of multiple paths, so you’d need to loop through their number. I see no way to avoid releasing compoundness on reconstruct of a single path item, meaning that you’ll be left with a bunch of disconnected paths. Why not just place your logo into an image frame?

I got it to work. Even the compound path parts. I’m sure there is a better way to do this but this is what I came up with.

I used this code to get entire path values of a selected path


tell application "Adobe InDesign CS3"
	return entire path of path 1 of selection
	return properties of path 1 of selection
end tell

Then I took those values and defined a variable for them. Then looped through the values to make slug. Then assigned this script to a hotkey. No more need to place manually or have this slug linked.

final code (some parts removed for simplification)


tell application "Adobe InDesign CS3"
	try
		set documentOpen to properties of document 1
	on error
		display dialog "Please open an InDesign document and try again"
		return
	end try
	set verticalOffset to 0
	set horizontalOffset to -1
	activate
	try
		tell document 1 to make color with properties {color value:{0, 80, 95, 0}, name:"Creative Orange"}
	end try
	
	-- Begin Make Creative
	set myPaths to {{{entire path:{{{1.16379609006, 0.16593846943}, {1.16379609006, 0.16593846943}, {1.159346084494, 0.164828055568}}, {{1.156003532294, 0.164828055568}, {1.149765538753, 0.164828055568}, {1.123929135283, 0.164828055568}}, {{1.100094634626, 0.188658077525}, {1.100094634626, 0.212261735376}, {1.100094634626, 0.225626630465}}, {{1.109227993598, 0.235416156884}, {1.123045161437, 0.235416156884}, {1.133946999472, 0.235416156884}}, {{1.146189638713, 0.231417816787}, {1.154438947928, 0.223178072252}, {1.154438947928, 0.223178072252}}, {{1.149541679683, 0.244554525926}, {1.149541679683, 0.244554525926}, {1.142400279294, 0.250569039948}}, {{1.132159087406, 0.25324107768}, {1.119702533326, 0.25324107768}, {1.101435359922, 0.25324107768}}, {{1.079388847241, 0.240993428368}, {1.079388847241, 0.21426804098}, {1.079388847241, 0.174853358953}}, {{1.115913173908, 0.147454800241}, {1.151329667659, 0.147454800241}, {1.15711090975, 0.147454800241}}, {{1.162902096072, 0.147904643866}, {1.167352101638, 0.149233375356}, {1.167352101638, 0.149233375356}}}}}, {{entire path:{{{1.243752871852, 0.16549120675}, {1.242645494397, 0.16549120675}, {1.225486229819, 0.16549120675}}, {{1.203215782158, 0.185536347989}, {1.196977864527, 0.221614019257}, {1.196977864527, 0.221614019257}}, {1.191867212814, 0.250792519467}, {1.171812051435, 0.250792519467}, {1.18963196216, 0.149900929328}, {1.206344495429, 0.149900929328}, {1.20277853962, 0.177517957489}, {{1.203215782158, 0.177743714313}, {1.203215782158, 0.177743714313}, {1.209453775699, 0.158811416062}}, {{1.224601724602, 0.148570224174}, {1.243082736935, 0.148570224174}, {1.243082736935, 0.148570224174}}, {{1.247086011192, 0.16549120675}, {1.247086011192, 0.16549120675}, {1.246201505975, 0.16549120675}}}}}, {{entire path:{{{1.30115811065, 0.216046160634}, {1.261961822162, 0.216046160634}, {1.263293058687, 0.227404750119}}, {{1.271532423671, 0.235416156884}, {1.286466913197, 0.235416156884}, {1.297378240002, 0.235416156884}}, {{1.307843366871, 0.231417816787}, {1.316082731855, 0.224499820008}, {1.316082731855, 0.224499820008}}, {{1.310962060001, 0.246342362081}, {1.310962060001, 0.246342362081}, {1.304277335151, 0.250792519467}}, {{1.294249602641, 0.25324107768}, {1.284902328831, 0.25324107768}, {1.259279840199, 0.25324107768}}, {{1.240809227558, 0.238102617547}, {1.240809227558, 0.210264842633}, {1.240809227558, 0.173514607321}}, {{1.274437733333, 0.147454800241}, {1.303383417074, 0.147454800241}, {1.322087377555, 0.147454800241}}, {{1.332328569443, 0.15769158934}, {1.332328569443, 0.172164013704}, {1.332328569443, 0.200014086064}}}}}, {{entire path:{{{1.309844738314, 0.165265298106}, {1.30160537333, 0.165265298106}, {1.287788205491, 0.165265298106}}, {{1.266859014497, 0.177743714313}, {1.26285581615, 0.200237565584}, {1.290916918762, 0.200237565584}}, {{1.312079457597, 0.186872670495}, {1.312079457597, 0.175300166171}, {1.312079457597, 0.169720313742}}}}}, {{entire path:{{1.417591016157, 0.250792519467}, {1.400878482887, 0.250792519467}, {1.403113733542, 0.231864624006}, {{1.402676339184, 0.231641296307}, {1.402676339184, 0.231641296307}, {1.394203246808, 0.247897002216}}, {{1.380629295131, 0.25324107768}, {1.366812734574, 0.25324107768}, {1.350547008523, 0.25324107768}}, {{1.334961741171, 0.241668573356}, {1.334961741171, 0.220059379123}, {1.334961741171, 0.175062263721}}, {{1.371942743378, 0.149009440376}, {1.406242294993, 0.149009440376}, {1.418708261933, 0.149009440376}}, {{1.428726126122, 0.149900929328}, {1.435187447362, 0.151013924136}, {1.435187447362, 0.151013924136}}}}}, {{entire path:{{{1.407787066807, 0.165707550714}, {1.404454458838, 0.165707550714}, {1.379512049355, 0.165707550714}}, {{1.35524023025, 0.18842731063}, {1.35524023025, 0.218713643756}, {1.35524023025, 0.230966151318}}, {{1.361478223791, 0.236538564552}, {1.371048825301, 0.236538564552}, {1.38418583808, 0.236538564552}}, {{1.402229076504, 0.220496621661}, {1.407116476428, 0.194217889671}, {1.407116476428, 0.194217889671}}, {{1.412246940693, 0.166161797129}, {1.412246940693, 0.166161797129}, {1.410682432237, 0.16593846943}}}}}, {{entire path:{{1.486646339465, 0.165044399532}, {1.518710792245, 0.165044399532}, {1.522053420355, 0.149900929328}, {1.489318377197, 0.149900929328}, {1.49466230084, 0.11894704223}, {1.481797805544, 0.118961465161}, {{1.481739202899, 0.119277403259}, {1.481739202899, 0.119277403259}, {1.481739202899, 0.119201644916}}, {{1.481739202899, 0.119138487661}, {1.481729790038, 0.11906834667}, {1.47425749725, 0.145958914572}}, {{1.45280346339, 0.151769078436}, {1.449811084771, 0.152454091745}, {1.449811084771, 0.152454091745}}, {1.449451422419, 0.152454091745}, {1.446779384688, 0.165044399532}, {1.466601198227, 0.165044399532}, {{1.456797248877, 0.220943428879}, {1.456797248877, 0.220943428879}, {1.453454620766, 0.239885595451}}, {{1.465269885791, 0.251676417403}, {1.479747168406, 0.251676417403}, {1.485081831009, 0.251676417403}}, {{1.489085029356, 0.250792519467}, {1.491990414928, 0.249004531492}, {1.491990414928, 0.249004531492}}, {{1.496003026136, 0.231417816787}, {1.496003026136, 0.231417816787}, {1.492650985165, 0.234089854519}}, {{1.490435774793, 0.234750576576}, {1.486646339465, 0.234750576576}, {1.480408345924, 0.234750576576}}, {{1.475511229499, 0.230077243312}, {1.476842390115, 0.222279599565}, {1.476842390115, 0.222279599565}}}}}, {{entire path:{{1.537813129261, 0.250792519467}, {1.517330745485, 0.250792519467}, {1.53514124335, 0.149900929328}, {1.555633647267, 0.149900929328}}}}, {{entire path:{{1.603030434736, 0.252570487301}, {1.594781125521, 0.252570487301}, {1.570732785936, 0.149900929328}, {1.590331119955, 0.149900929328}, {{1.600795791363, 0.194448808386}, {1.600795791363, 0.194448808386}, {1.602136516659, 0.200905575017}}, {{1.603924504634, 0.208919107266}, {1.60503188209, 0.216493271493}, {1.60503188209, 0.216493271493}}, {{1.605479144769, 0.216493271493}, {1.605479144769, 0.216493271493}, {1.609259015417, 0.208919107266}}, {{1.613718433843, 0.200905575017}, {1.61772163219, 0.194448808386}, {1.61772163219, 0.194448808386}}, {1.643567524431, 0.149900929328}, {1.66337977329, 0.149900929328}}}}, {{entire path:{{{1.711194673936, 0.216046160634}, {1.671988289395, 0.216046160634}, {1.673329470152, 0.227404750119}}, {{1.681568911046, 0.235416156884}, {1.696493456341, 0.235416156884}, {1.707405238607, 0.235416156884}}, {{1.717869910014, 0.231417816787}, {1.726109199088, 0.224499820008}, {1.726109199088, 0.224499820008}}, {{1.720979190284, 0.246342362081}, {1.720979190284, 0.246342362081}, {1.714303954205, 0.250792519467}}, {{1.704286090016, 0.25324107768}, {1.694919383204, 0.25324107768}, {1.669326271805, 0.25324107768}}, {{1.650835770702, 0.238102617547}, {1.650835770702, 0.210264842633}, {1.650835770702, 0.173514607321}}, {{1.684454863617, 0.147454800241}, {1.713409884307, 0.147454800241}, {1.73212371311, 0.147454800241}}, {{1.742365056818, 0.15769158934}, {1.742365056818, 0.172164013704}, {1.742365056818, 0.200014086064}}}}}, {{entire path:{{{1.719881225689, 0.165265298106}, {1.711631916474, 0.165265298106}, {1.697824768776, 0.165265298106}}, {{1.67688555764, 0.177743714313}, {1.672892227614, 0.200237565584}, {1.700943461906, 0.200237565584}}, {{1.722106000741, 0.186872670495}, {1.722106000741, 0.175300166171}, {1.722106000741, 0.169720313742}}}}}}
	
	repeat with x from 1 to count of myPaths
		set entirePath to item x of myPaths
		tell document 1
			set myPolygon to make polygon
			set entire path of path 1 of myPolygon to entire path of item 1 of entirePath
			set fill color of myPolygon to "Creative Orange"
			set label of myPolygon to ("Creative" & x as text)
			set stroke weight of myPolygon to 0
		end tell
	end repeat
	
	set myPolygon1 to polygon "Creative3" of document 1
	set myPolygon2 to polygon "Creative4" of document 1
	subtract path myPolygon2 with myPolygon1
	
	set myPolygon1 to polygon "Creative5" of document 1
	set myPolygon2 to polygon "Creative6" of document 1
	subtract path myPolygon2 with myPolygon1
	
	set myPolygon1 to polygon "Creative10" of document 1
	set myPolygon2 to polygon "Creative11" of document 1
	subtract path myPolygon2 with myPolygon1
	
	-- Begin Make Rectangle
	set myPaths to {{{entire path:{{0.0, 0.0}, {0.0, 0.375}, {1.875, 0.375}, {1.875, 0.0}}}}}
	
	repeat with x from 1 to count of myPaths
		set entirePath to item x of myPaths
		tell document 1
			set myPolygon to make polygon
			set entire path of path 1 of myPolygon to entire path of item 1 of entirePath
			set fill color of myPolygon to "None"
			set label of myPolygon to ("Rectangle" & x as text)
			set stroke weight of myPolygon to 0
		end tell
	end repeat
	
	-- Begin Group And Move
	set selection to every page item of document 1 whose label contains "e"
	set mySelection to selection
	tell active document to set myItem to make group with properties {group items:(mySelection)}
	set label of myItem to "CreativeSlug"
	set documentHeight to page height of document preferences of document 1
	set documentWidth to page width of document preferences of document 1
	
	set geometric bounds of group "CreativeSlug" of document 1 to {documentHeight - 0.375 + verticalOffset, documentWidth - 1.875 + horizontalOffset, documentHeight + verticalOffset, documentWidth + horizontalOffset}
end tell

CarbonQuark

That seems to work pretty good. I would have gone about it a bit different though.

  1. if something is selected then cut it and set the clipboard to a property so that it is stored.
  2. paste in place

This way if you just need to use the same slug, design what you want and run it. The item’s clipboard value is stored to the property which is a maintained until the next time you run the script with a selected item. If nothing is selected then it just pasts in place the clipboard item stored in the property. It is a bit of a bare bones thing right now, but would be easier to change to accommodate a new slug.

property theSlug : {}

tell application "Adobe InDesign CS3"
	set theSelection to selection
	if theSelection is not {} then
		cut
		set theSlug to the clipboard
	end if
end tell

tell application "Adobe InDesign CS3"
	set theSlug to the clipboard
	paste in place
end tell

I agree with Jerome. As an experiment it’s interesting (I actually did this same thing with a company logo as a joke script for my boss a few years ago) but as a practical application it’s a little long in the tooth. What happens if you make a change to your logo? Then recapture the path and copy and paste it again? Good learning experience though.

Cheers,
Jim Neumann
BLUEFROG

The main reason why I’m doing it this way is so I never have to open the file, go find the file, or deal with an external graphic link.

I have another script that gets the values needed to build the logo… so, if the slug needed to change it would only take a moment to update.

If I could store the clipboard contents to a file and read it back that would be ideal. But I don’t know how or if this is possible.

Thanks for the tips,
CarbonQuark

That is exactly what I have done.

The first part of the script copies the selected object to the clipboard, if nothing is selected then it does not execute. The clipboard, and InDesign object, is stored in the property theSlug. Since properties are persistent this is stored to the script, no need to create a second file. You would probably want to add in a dialog to ask the user if they want to replace the current stored item with the selected one.

The second part sets the clipboard to the InDesign object stored in theSlug then pastes it in place. This worked in my brief testing and if paste remembers layers is on then it should maintain the layering and positioning of the object.

The benefit of this is that you don’t have two scripts and don’t have to rework the thing if your slug has other colors added or text. Just make the new object and set it with the script and you are ready to go. Have more than one object you need to regularly add make a copy of the script, assign a different key command to it and you are good to go.

Jerome

Hi Guys

Slightly off topic but not too much, kinda staying with illustrator, this thread caught my eye.
A couple of years ago i had a go at creating a vector image of my company logo using the the entire path property.
so dug it out to show you guys now i’m not bragging cause its a good script don’t get me wrong,
i’m just like any bloke i was just impressed by it’s size! :smiley:


tell application "Adobe Illustrator"
	activate
	set thisDoc to current document
	set theOrigin to ruler origin of thisDoc as list
	set properties of thisDoc to {ruler origin:{0, 0}}
	set docheight to height of current document
	set docwidth to width of current document
	set locked of every layer of current document to true
	set mynewlayer to make new layer in current document
	set the name of current layer of document 1 to "Logo Layer"
	set swatch_one to make new spot in current document with properties {name:"PANTONE 306 C", color type:{spot color}, color:{cyan:75, magenta:0, yellow:7, black:0}}
	set swatch_two to make new spot in current document with properties {name:"PANTONE 2758 C", color type:{spot color}, color:{cyan:100, magenta:80, yellow:0, black:26}}
	set the default stroke color of document 1 to {class:no color info}
	set default fill color of document 1 to {spot:spot "PANTONE 306 C" of document 1}
	set lineRef to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{250.5048828125, 470.884765625}, left direction:{250.5048828125, 470.884765625}, right direction:{250.5048828125, 470.884765625}, point type:smooth}, {class:path point info, anchor:{250.5048828125, 523.7451171875}, left direction:{250.5048828125, 523.7451171875}, right direction:{250.5048828125, 528.3818359375}, point type:smooth}, {class:path point info, anchor:{242.1064453125, 532.13671875}, left direction:{246.7470703125, 532.13671875}, right direction:{237.4697265625, 532.13671875}, point type:smooth}, {class:path point info, anchor:{233.71484375, 523.7451171875}, left direction:{233.71484375, 528.3818359375}, right direction:{233.71484375, 523.7451171875}, point type:corner}, {class:path point info, anchor:{233.71484375, 439.6591796875}, left direction:{233.71484375, 439.6591796875}, right direction:{233.701171875, 435.9423828125}, point type:smooth}, {class:path point info, anchor:{239.921875, 431.5244140625}, left direction:{236.16015625, 432.53515625}, right direction:{244.3974609375, 430.3173828125}, point type:smooth}, {class:path point info, anchor:{250.2158203125, 437.4453125}, left direction:{249.025390625, 432.9658203125}, right direction:{255.8408203125, 458.60546875}, point type:smooth}, {class:path point info, anchor:{298.05859375, 474.193359375}, left direction:{275.1279296875, 474.193359375}, right direction:{320.9892578125, 474.193359375}, point type:smooth}, {class:path point info, anchor:{345.8955078125, 437.4453125}, left direction:{340.2734375, 458.60546875}, right direction:{347.1015625, 432.96875}, point type:smooth}, {class:path point info, anchor:{356.189453125, 431.5244140625}, left direction:{351.712890625, 430.3173828125}, right direction:{360.66796875, 432.7275390625}, point type:smooth}, {class:path point info, anchor:{362.11328125, 441.8115234375}, left direction:{363.3232421875, 437.3359375}, right direction:{354.49609375, 470.1064453125}, point type:smooth}, {class:path point info, anchor:{298.05859375, 490.990234375}, left direction:{328.75, 490.990234375}, right direction:{279.404296875, 490.990234375}, point type:smooth}, {class:path point info, anchor:{250.5048828125, 470.884765625}, left direction:{262.552734375, 483.283203125}, right direction:{250.5048828125, 470.884765625}, point type:corner}}}
	set default fill color of document 1 to {spot:spot "PANTONE 2758 C" of document 1}
	set lineRef1 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{362.11328125, 407.5771484375}, left direction:{362.11328125, 407.5771484375}, right direction:{354.49609375, 379.2822265625}, point type:smooth}, {class:path point info, anchor:{298.05859375, 358.40234375}, left direction:{328.75, 358.40234375}, right direction:{267.3671875, 358.40234375}, point type:smooth}, {class:path point info, anchor:{234.0009765625, 407.5771484375}, left direction:{241.546875, 379.2666015625}, right direction:{232.806640625, 412.0595703125}, point type:smooth}, {class:path point info, anchor:{239.921875, 417.8681640625}, left direction:{235.4453125, 416.6640625}, right direction:{244.3974609375, 419.078125}, point type:smooth}, {class:path point info, anchor:{250.2158203125, 411.947265625}, left direction:{249.025390625, 416.4267578125}, right direction:{255.8408203125, 390.7861328125}, point type:smooth}, {class:path point info, anchor:{298.05859375, 375.1962890625}, left direction:{275.1279296875, 375.1962890625}, right direction:{320.9892578125, 375.1962890625}, point type:smooth}, {class:path point info, anchor:{345.8955078125, 411.943359375}, left direction:{340.2734375, 390.7861328125}, right direction:{347.1015625, 416.419921875}, point type:smooth}, {class:path point info, anchor:{356.189453125, 417.8681640625}, left direction:{351.712890625, 419.078125}, right direction:{360.66796875, 416.6640625}, point type:smooth}, {class:path point info, anchor:{362.11328125, 407.5771484375}, left direction:{363.3232421875, 412.056640625}, right direction:{362.11328125, 407.5771484375}, point type:corner}}}
	set lineRef2 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{247.017578125, 333.1005859375}, left direction:{247.017578125, 333.1005859375}, right direction:{242.7919921875, 333.1005859375}, point type:smooth}, {class:path point info, anchor:{237.138671875, 328.671875}, left direction:{239.4296875, 331.2529296875}, right direction:{237.138671875, 328.671875}, point type:corner}, {class:path point info, anchor:{237.138671875, 343.822265625}, left direction:{237.138671875, 343.822265625}, right direction:{237.138671875, 344.796875}, point type:smooth}, {class:path point info, anchor:{235.4228515625, 345.5302734375}, left direction:{236.3984375, 345.5302734375}, right direction:{234.4580078125, 345.5302734375}, point type:smooth}, {class:path point info, anchor:{233.71484375, 343.822265625}, left direction:{233.71484375, 344.796875}, right direction:{233.71484375, 343.822265625}, point type:corner}, {class:path point info, anchor:{233.71484375, 320.5986328125}, left direction:{233.71484375, 320.5986328125}, right direction:{233.71484375, 320.560546875}, point type:smooth}, {class:path point info, anchor:{233.720703125, 320.4892578125}, left direction:{233.720703125, 320.53125}, right direction:{233.720703125, 320.3544921875}, point type:smooth}, {class:path point info, anchor:{233.71484375, 320.083984375}, left direction:{233.71484375, 320.2158203125}, right direction:{233.71484375, 314.279296875}, point type:smooth}, {class:path point info, anchor:{247.017578125, 306.9228515625}, left direction:{238.1875, 306.9228515625}, right direction:{254.556640625, 306.9228515625}, point type:smooth}, {class:path point info, anchor:{259.9365234375, 320.083984375}, left direction:{259.9365234375, 312.7919921875}, right direction:{259.9365234375, 327.3818359375}, point type:smooth}, {class:path point info, anchor:{247.017578125, 333.1005859375}, left direction:{254.556640625, 333.1005859375}, right direction:{247.017578125, 333.1005859375}, point type:corner}}}
	set default fill color of document 1 to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:0}
	set lineRef3 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{246.625, 309.9345703125}, left direction:{246.625, 309.9345703125}, right direction:{241.73046875, 309.9345703125}, point type:smooth}, {class:path point info, anchor:{237.158203125, 320.0712890625}, left direction:{237.158203125, 313.802734375}, right direction:{237.158203125, 326.345703125}, point type:smooth}, {class:path point info, anchor:{246.625, 330.0849609375}, left direction:{242.1162109375, 330.0849609375}, right direction:{252.6962890625, 330.0849609375}, point type:smooth}, {class:path point info, anchor:{256.46484375, 320.0712890625}, left direction:{256.46484375, 325.76953125}, right direction:{256.46484375, 314.375}, point type:smooth}, {class:path point info, anchor:{246.625, 309.9345703125}, left direction:{252.6962890625, 309.9345703125}, right direction:{246.625, 309.9345703125}, point type:corner}}}
	set default fill color of document 1 to {spot:spot "PANTONE 2758 C" of document 1}
	set lineRef4 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{286.5224609375, 319.10546875}, left direction:{286.5224609375, 319.10546875}, right direction:{286.5224609375, 319.10546875}, point type:smooth}, {class:path point info, anchor:{266.1181640625, 319.10546875}, left direction:{266.1181640625, 319.10546875}, right direction:{266.2919921875, 313.95703125}, point type:smooth}, {class:path point info, anchor:{275.7265625, 309.8447265625}, left direction:{270.408203125, 309.8447265625}, right direction:{279.4921875, 309.8447265625}, point type:smooth}, {class:path point info, anchor:{284.1796875, 313.8408203125}, left direction:{282.06640625, 311.5048828125}, right direction:{284.517578125, 314.240234375}, point type:smooth}, {class:path point info, anchor:{285.267578125, 314.4208984375}, left direction:{284.8623046875, 314.4208984375}, right direction:{285.55078125, 314.4208984375}, point type:smooth}, {class:path point info, anchor:{286.1748046875, 314.0732421875}, left direction:{285.888671875, 314.2978515625}, right direction:{286.5224609375, 313.7900390625}, point type:smooth}, {class:path point info, anchor:{286.6962890625, 312.9853515625}, left direction:{286.6962890625, 313.384765625}, right direction:{286.6962890625, 312.6953125}, point type:smooth}, {class:path point info, anchor:{286.3525390625, 312.078125}, left direction:{286.5771484375, 312.361328125}, right direction:{284.408203125, 309.4453125}, point type:smooth}, {class:path point info, anchor:{275.6044921875, 306.9296875}, left direction:{280.34765625, 306.9296875}, right direction:{268.3447265625, 306.9296875}, point type:smooth}, {class:path point info, anchor:{262.5751953125, 320.0126953125}, left direction:{262.5751953125, 312.6953125}, right direction:{262.5751953125, 327.330078125}, point type:smooth}, {class:path point info, anchor:{275.3212890625, 333.1005859375}, left direction:{268.0556640625, 333.1005859375}, right direction:{282.46484375, 333.1005859375}, point type:smooth}, {class:path point info, anchor:{287.83203125, 320.302734375}, left direction:{287.83203125, 327.2822265625}, right direction:{287.83203125, 319.5556640625}, point type:smooth}, {class:path point info, anchor:{286.5224609375, 319.10546875}, left direction:{287.3203125, 319.10546875}, right direction:{286.5224609375, 319.10546875}, point type:corner}}}
	set default fill color of document 1 to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:0}
	set lineRef5 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{275.3212890625, 330.1943359375}, left direction:{275.3212890625, 330.1943359375}, right direction:{270.294921875, 330.1943359375}, point type:smooth}, {class:path point info, anchor:{266.1181640625, 321.673828125}, left direction:{266.6328125, 326.529296875}, right direction:{266.1181640625, 321.673828125}, point type:corner}, {class:path point info, anchor:{284.408203125, 321.673828125}, left direction:{284.408203125, 321.673828125}, right direction:{283.8935546875, 326.474609375}, point type:smooth}, {class:path point info, anchor:{275.3212890625, 330.1943359375}, left direction:{280.34765625, 330.1943359375}, right direction:{275.3212890625, 330.1943359375}, point type:corner}}}
	set default fill color of document 1 to {spot:spot "PANTONE 2758 C" of document 1}
	set lineRef6 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{309.552734375, 329.849609375}, left direction:{309.552734375, 329.849609375}, right direction:{309.552734375, 329.849609375}, point type:smooth}, {class:path point info, anchor:{293.720703125, 310.46875}, left direction:{293.720703125, 310.46875}, right direction:{293.720703125, 310.46875}, point type:corner}, {class:path point info, anchor:{308.35546875, 310.46875}, left direction:{308.35546875, 310.46875}, right direction:{309.14453125, 310.46875}, point type:smooth}, {class:path point info, anchor:{309.7744140625, 309.046875}, left direction:{309.7744140625, 309.8447265625}, right direction:{309.7744140625, 308.2353515625}, point type:smooth}, {class:path point info, anchor:{308.35546875, 307.6142578125}, left direction:{309.14453125, 307.6142578125}, right direction:{308.35546875, 307.6142578125}, point type:corner}, {class:path point info, anchor:{290.7509765625, 307.6142578125}, left direction:{290.7509765625, 307.6142578125}, right direction:{289.779296875, 307.6142578125}, point type:smooth}, {class:path point info, anchor:{289.0869140625, 309.0947265625}, left direction:{289.0869140625, 308.0712890625}, right direction:{289.0869140625, 309.4453125}, point type:smooth}, {class:path point info, anchor:{289.4345703125, 310.1279296875}, left direction:{289.2060546875, 309.8447265625}, right direction:{289.4345703125, 310.1279296875}, point type:corner}, {class:path point info, anchor:{305.263671875, 329.505859375}, left direction:{305.263671875, 329.505859375}, right direction:{305.263671875, 329.505859375}, point type:corner}, {class:path point info, anchor:{290.6318359375, 329.505859375}, left direction:{290.6318359375, 329.505859375}, right direction:{289.83984375, 329.505859375}, point type:smooth}, {class:path point info, anchor:{289.1455078125, 330.9248046875}, left direction:{289.1455078125, 330.1298828125}, right direction:{289.1455078125, 331.732421875}, point type:smooth}, {class:path point info, anchor:{290.6318359375, 332.353515625}, left direction:{289.83984375, 332.353515625}, right direction:{290.6318359375, 332.353515625}, point type:corner}, {class:path point info, anchor:{308.35546875, 332.353515625}, left direction:{308.35546875, 332.353515625}, right direction:{309.263671875, 332.353515625}, point type:smooth}, {class:path point info, anchor:{309.8935546875, 330.7607421875}, left direction:{309.8935546875, 331.6162109375}, right direction:{309.8935546875, 330.419921875}, point type:smooth}, {class:path point info, anchor:{309.552734375, 329.849609375}, left direction:{309.7744140625, 330.1298828125}, right direction:{309.552734375, 329.849609375}, point type:corner}}}
	set lineRef7 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{314.830078125, 307.1640625}, left direction:{314.830078125, 307.1640625}, right direction:{313.8583984375, 307.1640625}, point type:smooth}, {class:path point info, anchor:{313.0537109375, 308.8759765625}, left direction:{313.0537109375, 307.9013671875}, right direction:{313.0537109375, 308.8759765625}, point type:corner}, {class:path point info, anchor:{313.0537109375, 331.1630859375}, left direction:{313.0537109375, 331.1630859375}, right direction:{313.0537109375, 332.1279296875}, point type:smooth}, {class:path point info, anchor:{314.830078125, 332.884765625}, left direction:{313.8583984375, 332.884765625}, right direction:{315.8017578125, 332.884765625}, point type:smooth}, {class:path point info, anchor:{316.4873046875, 331.1630859375}, left direction:{316.4873046875, 332.1279296875}, right direction:{316.4873046875, 331.1630859375}, point type:corner}, {class:path point info, anchor:{316.4873046875, 308.8759765625}, left direction:{316.4873046875, 308.8759765625}, right direction:{316.4873046875, 307.9013671875}, point type:smooth}, {class:path point info, anchor:{314.830078125, 307.1640625}, left direction:{315.8017578125, 307.1640625}, right direction:{314.830078125, 307.1640625}, point type:corner}}}
	set lineRef8 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{314.830078125, 339.50390625}, left direction:{314.830078125, 339.50390625}, right direction:{313.69140625, 339.50390625}, point type:smooth}, {class:path point info, anchor:{312.71875, 341.5595703125}, left direction:{312.71875, 340.4208984375}, right direction:{312.71875, 342.69921875}, point type:smooth}, {class:path point info, anchor:{314.830078125, 343.6162109375}, left direction:{313.69140625, 343.6162109375}, right direction:{315.96875, 343.6162109375}, point type:smooth}, {class:path point info, anchor:{316.83203125, 341.5595703125}, left direction:{316.83203125, 342.69921875}, right direction:{316.83203125, 340.4208984375}, point type:smooth}, {class:path point info, anchor:{314.830078125, 339.50390625}, left direction:{315.96875, 339.50390625}, right direction:{314.830078125, 339.50390625}, point type:corner}}}
	set lineRef9 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{343.5078125, 319.10546875}, left direction:{343.5078125, 319.10546875}, right direction:{343.5078125, 319.10546875}, point type:smooth}, {class:path point info, anchor:{323.11328125, 319.10546875}, left direction:{323.11328125, 319.10546875}, right direction:{323.2802734375, 313.95703125}, point type:smooth}, {class:path point info, anchor:{332.7080078125, 309.8447265625}, left direction:{327.392578125, 309.8447265625}, right direction:{336.482421875, 309.8447265625}, point type:smooth}, {class:path point info, anchor:{341.1650390625, 313.8408203125}, left direction:{339.0537109375, 311.5048828125}, right direction:{341.5126953125, 314.240234375}, point type:smooth}, {class:path point info, anchor:{342.255859375, 314.4208984375}, left direction:{341.853515625, 314.4208984375}, right direction:{342.5361328125, 314.4208984375}, point type:smooth}, {class:path point info, anchor:{343.1728515625, 314.0732421875}, left direction:{342.8828125, 314.2978515625}, right direction:{343.5078125, 313.7900390625}, point type:smooth}, {class:path point info, anchor:{343.677734375, 312.9853515625}, left direction:{343.677734375, 313.384765625}, right direction:{343.677734375, 312.6953125}, point type:smooth}, {class:path point info, anchor:{343.3369140625, 312.078125}, left direction:{343.5654296875, 312.361328125}, right direction:{341.390625, 309.4453125}, point type:smooth}, {class:path point info, anchor:{332.595703125, 306.9296875}, left direction:{337.341796875, 306.9296875}, right direction:{325.33984375, 306.9296875}, point type:smooth}, {class:path point info, anchor:{319.5634765625, 320.0126953125}, left direction:{319.5634765625, 312.6953125}, right direction:{319.5634765625, 327.330078125}, point type:smooth}, {class:path point info, anchor:{332.3095703125, 333.1005859375}, left direction:{325.0498046875, 333.1005859375}, right direction:{339.453125, 333.1005859375}, point type:smooth}, {class:path point info, anchor:{344.8271484375, 320.302734375}, left direction:{344.8271484375, 327.2822265625}, right direction:{344.8271484375, 319.5556640625}, point type:smooth}, {class:path point info, anchor:{343.5078125, 319.10546875}, left direction:{344.3125, 319.10546875}, right direction:{343.5078125, 319.10546875}, point type:corner}}}
	set default fill color of document 1 to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:0}
	set lineRef10 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{332.3095703125, 330.1943359375}, left direction:{332.3095703125, 330.1943359375}, right direction:{327.2802734375, 330.1943359375}, point type:smooth}, {class:path point info, anchor:{323.11328125, 321.673828125}, left direction:{323.6279296875, 326.529296875}, right direction:{323.11328125, 321.673828125}, point type:corner}, {class:path point info, anchor:{341.390625, 321.673828125}, left direction:{341.390625, 321.673828125}, right direction:{340.8818359375, 326.474609375}, point type:smooth}, {class:path point info, anchor:{332.3095703125, 330.1943359375}, left direction:{337.341796875, 330.1943359375}, right direction:{332.3095703125, 330.1943359375}, point type:corner}}}
	set default fill color of document 1 to {spot:spot "PANTONE 2758 C" of document 1}
	set lineRef11 to make new path item in current layer of current document with properties {entire path:{{class:path point info, anchor:{360.9228515625, 332.3701171875}, left direction:{360.9228515625, 332.3701171875}, right direction:{360.9228515625, 332.3701171875}, point type:smooth}, {class:path point info, anchor:{356.8037109375, 332.3701171875}, left direction:{356.8037109375, 332.3701171875}, right direction:{351.88671875, 332.3701171875}, point type:smooth}, {class:path point info, anchor:{347.8935546875, 323.4560546875}, left direction:{347.8935546875, 328.3798828125}, right direction:{347.8935546875, 323.4560546875}, point type:corner}, {class:path point info, anchor:{347.8935546875, 308.8759765625}, left direction:{347.8935546875, 308.8759765625}, right direction:{347.8935546875, 307.9013671875}, point type:smooth}, {class:path point info, anchor:{349.55078125, 307.1640625}, left direction:{348.63671875, 307.1640625}, right direction:{350.46484375, 307.1640625}, point type:smooth}, {class:path point info, anchor:{351.265625, 308.8759765625}, left direction:{351.265625, 307.9521484375}, right direction:{351.265625, 308.8759765625}, point type:corner}, {class:path point info, anchor:{351.265625, 323.7880859375}, left direction:{351.265625, 323.7880859375}, right direction:{351.265625, 326.84765625}, point type:smooth}, {class:path point info, anchor:{356.8037109375, 329.3291015625}, left direction:{353.7431640625, 329.3291015625}, right direction:{356.8037109375, 329.3291015625}, point type:corner}, {class:path point info, anchor:{360.9228515625, 329.3291015625}, left direction:{360.9228515625, 329.3291015625}, right direction:{361.78125, 329.3291015625}, point type:smooth}, {class:path point info, anchor:{362.40625, 330.8349609375}, left direction:{362.40625, 329.9755859375}, right direction:{362.40625, 331.6875}, point type:smooth}, {class:path point info, anchor:{360.9228515625, 332.3701171875}, left direction:{361.78125, 332.3701171875}, right direction:{360.9228515625, 332.3701171875}, point type:corner}}}
	set grouped_logo to make new group item at end of current layer of current document
	set selection to every path item of current layer of current document
	move every path item of current layer of current document to end of grouped_logo
	scale page item 1 of thisDoc horizontal scale 50.0 vertical scale 50.0 about center
	set VisW to width of selection
	set VisH to height of selection
	set x to {20, 20 + VisH}
	set position of selection to x
end tell

Jerome,

The solution that I was trying to solve is one where I store the slug within my script so that I would avoid ever having to open it, place it , copy it, maintain an external link, etc.

Are you saying that with your script that the slug would be “permanently” saved within the one script file (within the .scpt file) and that I would only have to copy it once and that I would “never” have to copy it again even after I restarted my computer or copied something else to my clipboard?

Because, if that’s not the case that solution doesn’t solve the number one thing I set out to solve: to avoid ever having to open, place , copy , maintain external link etc.

Thanks,
CarbonQuark

Pidge1,

Nice script and nice logo.

Thanks for sharing,
CarbonQuark

Carbon,

I admire your perservierance (and Pidges) in creating the script. It is a great exercise and does what you want it to do, and I have done similar things in the past. Hard coding the path points in is probably the best way to ensure that you will get what you want and will probably work with the next version of ID as well with little or no reworking. Personally I would do this with a base template with the slug on it’s own layer and use that when making new documents.

Now to the solution that I came up with. My main goals was to simplify the storing and creation of the element, and to add flexibility to the script. Upon looking at it again I did see an error made in haste here:

tell application "Adobe InDesign CS3"
   set theSlug to the clipboard
   paste in place
end tell

Which should be:

tell application "Adobe InDesign CS3"
   set the clipboard to theSlug
   paste in place
end tell

The result of the error is that it keeps resetting the property theSlug to whatever is in the clipboard. The fix appears to work mostly as expected but you loose the positioning and layering of the element. While this is a problem the solution could add even more flexibility to the script. Since the pasted element is selected you could move it to a pre-determined offset easily enough. If you set this as a function of the bottom right corner of the page then it doesn’t matter what page size you’re document is. You could fix the layering easily enough as well.

As for storing the element, the property automatically stores what is set to it when the script is run. It will be reset if you recompile the script and save it or if you have an item selected when you run it, other than that it should remain there for future use.

The bottom line though is to use what works for you. There is nothing wrong with your solution and since everything is hard coded in the only way to mess it up is to open the file up and change something. This could be a very good thing since it eliminates accidental setting of the ID element and does not rely on any other files.

-Jerome

@pidge1: Hey, nice logo there.

@CarbonQuark: It really seems like you are trying to kill a fly with a howitzer.

. from a pure workflow standard I can’t see what benefit you think you’ll gain by this. Jerome’s comments underscore some of the weaknesses of the approach. You’re also building a very static setup that negates flexibility for future change.

But this is your setup and there may be something I’m missing but I encourage you to take a second look at why you want to avoid the other options.

Respectfully,
Jim

Hey guys,

Thanks for the suggestions. I’ve tried working with Jerome’s script and I can’t seem to get it to save the slug for use after restart or recompile.

This slug is just a small part of a larger script that is part of an Applescript Application built in Xcode & IB. The main application is not designed to use a prebuilt InDesign page. The slug will never change and I will never need to repeat this function for other vector objects.

I would love to know if the clipboard could be saved to a file and then read back in order to push back to the clipboard to paste. I remember trying to do this a long time ago with no success. If this is possible, Jerome’s script would be ideal.

BLUEFROG,

Too funny!

CarbonQuark

Carbon,

If it is part of an Xcode project then using a property will not work. AppleScript properties are not persistant in Xcode projects. You should still be able to do it by storing it to a user default. One note of caution you have to set the clipboard inside of

Another thing that you might try doing is importing a PDF of the graphic into your project, which will save it as a resource in the application bundle. Then you can place it from there and then embedding the graphic into the ID file using the unlink command if you want to break the link to the original graphic. You can get the path to the bundle with the following:

set BundlePath to (POSIX file (resource path of main bundle)) as string

Of course you could keep what you have, after all it is working for you. It all depends on what the project is and if you think that you would need the flexibility of updating the graphic.

-Jerome

Jerome,

That’s actually how I was doing it before this new script (storing it within the bundle). Never thought about breaking the link - that’s a good idea. I’ll give it a go.

Thanks,
CarbonQuark

Carbon,

Sometimes the simple solutions are the hardest to come up with. I think that this is probably the best route, easy to manage and change. By the way, what is the full Xcode application?

-Jerome

Jerome,

The Xcode app that needed this code creates publication and print templates w/ live, bleed and trim marks, color bars, slugs for project information, time stamp etc. - That app works with another Xcode app that I developed that automates the creation of PDF files and routes them for approval. Both apps work with Quark and InDesign.

Thanks for your help!
CarbonQuark