Clutch Cargo
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Clutch Cargo
-
-
thx for the input. Yea, the script at the bottom is not clearly defined. I should repost when I have a little something more concrete to show the error message which is usually something like "vbscript (or Illustrator), does not support this method"
-
Hey there... my first post.
Over the months I think I have become a fairly good beginner with vbscript and have even interfaced with Photoshop and Illustrator but this one has stumped me for weeks. If you are familiar with Illustrator I am trying to take a Tiff image and trace it with a custom trace I have created. So if you are interested in vbscript and Illustrator I could really use a second pair of eyes. Apparently, it can be done. I have API documentation, Java and VBA examples but this is over my head.
Any takers?
Here is what I have so far (one of many renditions):Set App = CreateObject("Illustrator.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = FSO.GetFolder("S:\SOCAL\Section_31\Land Cover")
Dim FileRef
For Each FileRef In SourceFolder.Files
Set AutoCADOpenOptions = App.Preferences.AutoCADFileOptions
AutoCADOpenOptions.MergeLayers = false
CurrentInteractionLevel = App.UserInteractionLevel
App.UserInteractionLevel = -1 ' aiDontDisplayAlerts
Set myDoc = App.Open(FileRef.Path,2)
App.UserInteractionLevel = CurrentInteractionLevel
ubound(App.TracingPresetsList)
' The line below loads tiff file into Illustrator ready for a custom trace
App.DoScript "LandCover-1", "Land Cover Auto"
' From thi point on I am having no success. Need help building this out.
Dim idoc : idoc = App.ActiveLayer
Dim iplaced : iplaced = App.PlacedItem
Dim itraced : itraced = App.ActiveLayer
Dim iFile : iFile = FileRef.PlacedItems.Trace
iFile.tracing.tracingOptions.loadFromPreset(tracingPresets[3])
Add JavaScript inside Vscript
in JavaScript
Posted
I am trying to add some JS code inside my vbscript. I know literally nothing regarding JS so what I have researched I have come up with this but I get a "syntax error" at the 'Sub Trace()' line.
Can anyone show me the proper way?
Set App = CreateObject("Illustrator.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = FSO.GetFolder("S:\SOCAL\Section_31\buildCOM TIFFs")
Set TIFFfile = SourceFolder.Files
Dim FileRef
For Each FileRef In SourceFolder.Files
Set AutoCADOpenOptions = App.Preferences.AutoCADFileOptions
AutoCADOpenOptions.MergeLayers = false
CurrentInteractionLevel = App.UserInteractionLevel
App.UserInteractionLevel = -1 ' aiDontDisplayAlerts
Set myDoc = App.Open(FileRef.Path,2)
App.UserInteractionLevel = CurrentInteractionLevel
Call Trace()
Sub Trace()
<Script Language="JavaScript">
function traceRaster(){
var docRef = App.ActiveDocument;
for(var a=0;a<docRef.placedItems.length;a++){
//this script implies the images are LINKED, not embedded. if you are working with embedded images, change 'placedItems' to 'rasterItems'
var item = docRef.placedItems[a];
var traced = item.trace();
traced.tracing.tracingOptions.loadFromPreset("Land Cover");
//Change 'Line Art' or your preferred tracing preset if necessary
}
docRef.close(SaveOptions.SAVECHANGES);
}
</Script>
End Sub
Next