Object required 'sel'


hello,

 

i trying recreate following script in vbscript: http://forums.adobe.com/message/4173641

 

the below code hjave far, @ moment error described in title of discussion. happening in loop @ method "moveobjects".

 

any light on this?

 

thank you.

 

edit: when "set sel = currdoc.selection()" gives me empty error??

 

set appref = createobject("illustrator.application")  ''''create host document set docpreset = createobject("illustrator.documentpreset") docpreset    .documenttitle = "tmpportfolio"    .documentcolorspace = 2    .documentrasterresolution = 3    .documentunits = 8     .numartboards = 12    .artboardrowsorcols = 4    .width = 841.89    .height = 595.28 end  appref.documents.adddocument "aidocumentcolorspace.aidocumentcmykcolor", docpreset  dim tmpdocumentlayerstate tmpdocumentlayerstate = unlockhidelayers(appref.documents("tmpportfolio")) ''''create host document   ''''transfer artboards dim arrfiles(0) arrfiles(0) = "c:\scripts\testfiles\testing\lw - bot3.ai" set currdoc = appref.open(arrfiles(0))  dim currdocumenttitle dim currnumartboards dim currdocumentlayerstate dim absinfo()  currdocumenttitle = currdoc.name currnumartboards = currdoc.artboards.count currdocumentlayerstate = unlockhidelayers(currdoc) redim absinfo(currnumartboards - 1, 1)  currdoc.activate()  = 1 currnumartboards    absinfo(i - 1, 0) = currdoc.artboards(i).artboardrect    absinfo(i - 1, 1) = currdoc.artboards(i).name     currdoc.selection = nothing    currdoc.artboards.setactiveartboardindex(i - 1)    currdoc.selectobjectsonactiveartboard     dim sel    sel = currdoc.selection     moveobjects sel, appref.documents("tmpportfolio") next ''''transfer artboards   ''''functions function unlockhidelayers(doc)    dim layercount    layercount = doc.layers.count    dim layerstate()    redim layerstate(layercount - 1, 1)    = 1 layercount        set ilayer = doc.layers(i)       layerstate(i - 1, 0) = ilayer.visible       layerstate(i - 1, 1) = ilayer.locked       ilayer.visible = true       ilayer.locked = false    next    unlockhidelayers = layerstate end function  sub moveobjects(sel, destdoc)    msgbox("")    = 1 sel.length       'dim newitem       'newitem = sel(i).duplicate destdoc.layers(sel(i).layer.name), "elementplacement.placeatend"    next end sub ''''functions 

i haven't tried try this

 

change this

currdoc.activate()

 

to this

currdoc.activate

 

 

to selection, correct

sel = currdoc.selection

 

 

and loop through items in selection array, in vb use

    sel = currdoc.selection     j = lbound(sel) ubound(sel)          'your code         sel(j).selected = false     next 

 




More discussions in Illustrator Scripting


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account