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

Convert PlacedItem...

Participant ,
Aug 19, 2017 Aug 19, 2017

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!

TOPICS
Scripting
845
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

Participant , Aug 20, 2017 Aug 20, 2017

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

Translate
Adobe
Community Expert ,
Aug 19, 2017 Aug 19, 2017

I'm not Windows user. So below  dosn't tested.

myPlacedItem.File = VegMask

Plobably, need to "=" between property and strings.

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
Participant ,
Aug 20, 2017 Aug 20, 2017

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.

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
Participant ,
Aug 20, 2017 Aug 20, 2017

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

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
Community Expert ,
Aug 20, 2017 Aug 20, 2017
LATEST

VBs property must be starts upper case...

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