Copy link to clipboard
Copied
I found this script from a post 2 years ago from Qwertyfly. Being so old I though I would post my issue in a new thread. It appears to be exactly what want however when I run the script I always get the following error message "cannot find tracing preset that has been set in the script". I have tried several of the default trace presets but always the same message.
What I am doing is using a VBscript to load a TIFF file, I make sure the document is selected then call the myTrace script. I also tried the script by having it in the Illustrator's File/Scripts folder and running it directly. Same error message. FYI, I am using Illustrator CS6.
If Qwertyfly happens to see this or if someone can chime in that would be great.
Here's the script. I commented out the lines of code that play an action. Just want to trace for now.
function myTrace(){
//-----User Set Variables-------
var Tracing_Preset = '16 colors';
//var My_Action_Name = 'Rotate .5';
//var From_Set_Name = 'MyActions';
//--------------------------------------
if(app.tracingPresetsList.indexOf(Tracing_Preset)<0){
alert('cannot find tracing preset that has been set in the script');
return;
}
var doc = app.activeDocument;
var sel = doc.selection;
for(var i = 0; i<sel.length; i++){
//if(sel == '[RasterItem ]'){ //This line was quoted as a mistake and new line is below it.
if(sel.typename == 'RasterItem'){
var pic = sel.trace();
pic.tracing.tracingOptions.loadFromPreset(Tracing_Preset);
pic.tracing.expandTracing().selected = true;
}
}
// no test to confirm the action is present. make sure action name and set name are correct. they are case sensitive.
//app.doScript(My_Action_Name, From_Set_Name); // don't want this Action to happen so commented out.
}
// add indexOf prototype to Array's
Array.prototype.indexOf = function(needle) {
for(var i = 0; i < this.length; i++) {
if(this === needle) {
return i;
}
}
return -1;
};
myTrace();
Hey guys,
After trying about everything I could think of (which ain't much, ha!), I commented out:
if(app.tracingPresetsList.indexOf(Tracing_Preset)<0){
alert('cannot find tracing preset that has been set in the script');
return
just to see what would happen... and it worked like a charm! Can use upper or lower case. Even my custom preset!
oh, to answer:
Where do you come from? USA
Which language your Illustrator has? English
Copy link to clipboard
Copied
Sorry for the delayed response.. i've looked at this a few times and couldn't come up with anythig. but after looking at it a 4th time, i think i have an idea..
After some brief testing, looks like it's a case sensitivity issue. The names of the default presets are title case, but you have a lowercase c in "16 colors".
If you change that variable definition to "16 Colors" it should work.
Copy link to clipboard
Copied
Where do you come from?
Which language your Illustrator has?
The preset list names are depend on your language.
Try
alert(app.tracingPresetsList.join("\n"))
to get the (real) names of your presets.
Have fun
Copy link to clipboard
Copied
Hey guys,
After trying about everything I could think of (which ain't much, ha!), I commented out:
if(app.tracingPresetsList.indexOf(Tracing_Preset)<0){
alert('cannot find tracing preset that has been set in the script');
return
just to see what would happen... and it worked like a charm! Can use upper or lower case. Even my custom preset!
oh, to answer:
Where do you come from? USA
Which language your Illustrator has? English
Find more inspiration, events, and resources on the new Adobe Community
Explore Now