-
1. Re: VBSCRIPT ID2.0 - How to convert user's selection to a 'direct selection'
Dave Saunders Apr 24, 2009 7:39 PM (in response to AaronKuehn)You need to address the first graphic of the selection. I don't know the syntax for that in VB.
Dave
-
2. Re: VBSCRIPT ID2.0 - How to convert user's selection to a 'direct selection'
AdobeScripts Apr 25, 2009 10:19 AM (in response to AaronKuehn)this will work for ID 2.0.x:
Set myImage = myInDesign.Selection.Item(1).Images
this for ID CSx:
Set myImage = myInDesign.Selection.Item(1).AllGraphics.Item(1)
robin
www.adobescripts.co.uk
-
3. Re: VBSCRIPT ID2.0 - How to convert user's selection to a 'direct selection'
AaronKuehn Apr 27, 2009 9:15 AM (in response to AdobeScripts)Still having trouble. I get an error 438 when trying to resize that image. It allows me to do the "set" without error, but after that I can't seem to do anything with it. I've tried to MsgBox the ID of the image, MsgBox the rotationangle -- but nothing seems to work.
Any other thought?
Thanks!
<<Actual Code Below>>
'' Start Error Handling
On Error Resume Next'' CHANGE THIS VARIABLE TO THE DESIRED HORIZONTAL SCALING PERCENTAGE
scaleFactor = 200Set myInDesign = CreateObject("InDesign.Application.2.0")
set myDocument = myInDesign.Documentsif myInDesign.documents.count < 1 then
MsgBox "You must have a document open in order to change the Baseline Grid."
else
Set mySelection = myInDesign.Selection
If mySelection.Count = 0 Then
''Nothing is selected -- tell user to select something.
MsgBox "You must have a graphic frame selected."Else
If TypeName(mySelection.Item(1)) = "Image" Then ''IF USER HAS DIRECT-SELECTED THE GRAPHIC, ANAMORPHICALLY SCALE IT.
mySelection.Item(1).resize scaleFactor,100,1095656308,false,falseElseIf TypeName(mySelection.Item(1)) = "Rectangle" Then ''IF USER HAS ONLY SELECTED THE FRAME, SELECT THE GRAPHIC AND ANAMORPHICALLY SCALE IT.
set myImage = myInDesign.Selection.Item(1).Images
myImage.resize scaleFactor,100,1095656308,false,false
Else
''The selection is not a graphic or a frame frame -- tell user to select one
MsgBox "You must have a graphic frame selected." & vbCrLf & TypeName(mySelection)
End If
end if
end if''ERROR HANDLER
if err.number > 0 Then
MsgBox "An error occurred while trying to scale the graphic." & vbCrLf & vbCrLf & "Error information: " & err.number & "_" & err.description
End If -
4. Re: VBSCRIPT ID2.0 - How to convert user's selection to a 'direct selection'
AdobeScripts Apr 27, 2009 9:35 AM (in response to AaronKuehn)sorry, it is my fault, I didn't tested it - I've misinterpreted ObjectBrowser's description
you need to change line:
Set myImage = myInDesign.Selection.Item(1).Images
to:
Set myImage = myInDesign.Selection.Item(1).Images.Item(1)
so - all versions of InDesign return collection of Images
robin
www.adobescripts.co.uk
-
5. Re: VBSCRIPT ID2.0 - How to convert user's selection to a 'direct selection'
AaronKuehn Apr 27, 2009 10:17 AM (in response to AdobeScripts)Thanks so much! That did the trick!


