Copy link to clipboard
Copied
trying to script in vbscript PlacedItem() below is a JavaScript example which does work nicely but I need to convert to vbscript.
var file = File('C:\SOCAL\Section_32\Masks\SOCAL_Section_32_vegmask.tif');
var idoc = app.activeDocument;
var iplaced = idoc.placedItems.add();
iplaced.file = file;
When I try to adapt to vbscript I use:
Set App = CreateObject("Illustrator.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim VegMask, myDoc, myPlacedItem
VegMask = "C:\SOCAL\Section_32\Masks\SOCAL_Section_32_vegmask.tif"
myDoc = App.ActiveDocument
myPlacedItem = myDoc.placedItems.Add()
myPlacedItem.file VegMask
However when I run it I get an error "invalid character" referring to the last line. Tried several iterations with no luck. Can anyone see where I am going wrong on my conversion? THx!
Yes! Got it...
Dim VegMask, myDoc, myPlacedItem
VegMask = "C:\SOCAL\Section_32\Masks\SOCAL_Section_32_vegmask.tif"
Set myDoc = App.ActiveDocument
myDoc.PlacedItems.Add().File = VegMask
Copy link to clipboard
Copied
I'm not Windows user. So below dosn't tested.
myPlacedItem.File = VegMask
Plobably, need to "=" between property and strings.
Copy link to clipboard
Copied
Thx for the reply. Yea I've tried:
myPlacedItem.file = VegMask
myPlacedItem.file(VegMask)
myPlacedItem.file.VegMask
myPlacedItem.file VegMask
Same error message so I suspect that even though the error refers to that line it may not be that line at all.
Copy link to clipboard
Copied
Yes! Got it...
Dim VegMask, myDoc, myPlacedItem
VegMask = "C:\SOCAL\Section_32\Masks\SOCAL_Section_32_vegmask.tif"
Set myDoc = App.ActiveDocument
myDoc.PlacedItems.Add().File = VegMask
Copy link to clipboard
Copied
VBs property must be starts upper case...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now