Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

load preset tracingoptions presetname applescript

New Here ,
Jan 24, 2010 Jan 24, 2010

Howdy,

I've looked and searched and searched and looked and can find no example code of how to load or create a tracingoptions object to set how a placed image is traced via AppleScript.

I can trace an image using the default preset (which is more or less worthless for me). I've been over the documentation (both the AppleScript dictionary for Illustrator and the Adobe AppleScript Guide) with no lights going off over my head.

Any help greatly appreciated.

TOPICS
Scripting
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jan 25, 2010 Jan 25, 2010

Ok, here is some thing that may get you started. When you trace a placed item the result is a plug-in object. This plug-in object has a tracing object which in turn has tracing options object with properties that can be set just like anything else. Its just nested a level or two deeper. I must admit I did not find the documentation on this very good and it did take a while for me to get my head around what was going on. You would probably want to wrap the trace command in a try block just in cas

...
Translate
Adobe
Guru ,
Jan 25, 2010 Jan 25, 2010

Tracing the object with default options is the norm. Once traced you edit the settings afterwards to the desired result.

I've only done this using JavaScript which I have recently switched to using but I will see if I can knock-up an example

of the same thing in AppleScript. Its a very cool feature had much fun with this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 25, 2010 Jan 25, 2010

Ok, here is some thing that may get you started. When you trace a placed item the result is a plug-in object. This plug-in object has a tracing object which in turn has tracing options object with properties that can be set just like anything else. Its just nested a level or two deeper. I must admit I did not find the documentation on this very good and it did take a while for me to get my head around what was going on. You would probably want to wrap the trace command in a try block just in case you are passing this something that may be too complex to draw.

tell application "Adobe Illustrator"

activate

set Doc_Ref to current document

tell Doc_Ref

set This_Image to the first placed item

set This_Trace to trace placed This_Image

set properties of tracing options of tracing of This_Trace to ¬

{corner angle:90, fills:true, live paint output:false, maximum colors:20, maximum stroke weight:2, minimum area:4, minimum stroke length:40, output swatches:true, path fitting:0, preprocess blur:0, resample resolution:72, strokes:false, tracing mode:color tracing mode}

set This_Group to expand tracing of tracing of This_Trace

end tell

end tell

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2010 Jan 25, 2010

You hit the problem on the head exactly. I was trying to load the properties BEFORE I had the tracing object (with its tracingoptions object).

Thanks so very much. I found no info anywhere on the web about this so I'm sure it will help others that may be scratching their heads as well.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 25, 2010 Jan 25, 2010

Glad, it helped my AppleScript has gotten a little rusty as of late because of the time I've been putting into JavaScript.

Can't quite get my head around to correct syntax for load and save to presets.

The fact that I can do something in JS that I can't in AS is a little surprising!!!

I will re-look at this when I get home where I can check how I did it.

Happy tracing…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 25, 2010 Jan 25, 2010

OK, I had another quick look at this and see what I was overlooking before.

These two snippets should get you most of what can be done with the tracing suite.

Example 1. Create a new set of options use them to make tracing object whilst this is still live store the object to presets. Then expand.

tell application "Adobe Illustrator"

activate

set Trace_Options to ¬

{corner angle:90, fills:true, live paint output:false, maximum colors:20, maximum stroke weight:2, minimum area:4, minimum stroke length:40, output swatches:true, path fitting:0, preprocess blur:0, resample resolution:72, strokes:false, tracing mode:color tracing mode}

set Doc_Ref to current document

tell Doc_Ref

set This_Image to the first placed item

set This_Trace to trace placed This_Image

tell This_Trace

tell tracing

tell tracing options

set properties to Trace_Options

end tell

end tell

end tell

set This_Preset to tracing options of tracing of This_Trace

store preset This_Preset presetname "Marks Test"

set This_Group to expand tracing of tracing of This_Trace

end tell

end tell

Example 2. Get a list of the available tracing presets pick one to use. You can expand if required. The other option for tracing is release which i've done here which takes you back to the placed item. But only if the trace is still live.

tell application "Adobe Illustrator"

activate

set Tracing_List to tracing presets

set Doc_Ref to current document

tell Doc_Ref

set This_Preset to choose from list Tracing_List without multiple selections allowed and empty selection allowed

set This_Image to the first placed item

set This_Trace to trace placed This_Image

tell This_Trace

tell tracing

tell tracing options

load preset presetname This_Preset

end tell

--set This_Group to expand tracing

end tell

end tell

set This_Image to release tracing of tracing of This_Trace

end tell

end tell

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2010 Jan 25, 2010
LATEST

Thanks so much. This has been very instructive and helpful.

Cheers!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines