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

VBScript - Select all objects

New Here ,
Apr 09, 2009 Apr 09, 2009

Hi everybody,

I am looking for the syntax to select all objects of an InDesign document in VBScript.

I guess I have to use "idSelectAll.idAll" or something like "myInDesign.idSelectAll.idAll = 1634495520", but I can't find the proper way to put it.

I also tried to use the menu action [Set myMenuAction = myInDesign.MenuActions.Item("$ID/Edit.SelectAll") followd by myMenuAction.Invoke] but there is an error too.

I'm quite new in VBScripting. I went through a lot of reference material now but I still need some help!

Many thanks in advance.

Eliane

TOPICS
Scripting
4.8K
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
Valorous Hero ,
Apr 09, 2009 Apr 09, 2009

Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.CS3")
myInDesign.Select 1634495520

rem or  alternatively

myInDesign.Select idSelectAll.idAll

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
LEGEND ,
Apr 09, 2009 Apr 09, 2009

Kasyan Servetsky wrote:

Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.CS3")
myInDesign.Select 1634495520

rem or  alternatively

myInDesign.Select idSelectAll.idAll

but I think Eliane want to select ALL objects from entire document

what is impossible - only objects on same spread could be selected at once

so ... as workaround - for small and simple/uncomplicated documents all pages could be combined as one spread

robin

--

www.adobescripts.co.uk

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
Valorous Hero ,
Apr 09, 2009 Apr 09, 2009

Oops! I just overlook that.

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
New Here ,
Apr 09, 2009 Apr 09, 2009

When I posted this question I wanted to find something to select all objects of... I didn't specify. But, yes, Robin, you're right! I will have to take this into account. In fact, I'm working with layers... So now, I have to continue searching to find the better solution!

Thanks for you help and comments!

Eliane

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
New Here ,
Apr 09, 2009 Apr 09, 2009

Well, "myInDesign.Select 1634495520" works!!!! but not your alternative solution.

"Dim myInDesign As InDesign.Application" is not accepted neither (Robin, which is another point concerning the differences between VBS and VB6), but the point is that I have the solution to my first problem. I can now continue.

Solution:

'Select all objects

Set myInDesign = CreateObject("InDesign.Application.CS3")
myInDesign.Select 1634495520

Many thanks!

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
LEGEND ,
Apr 09, 2009 Apr 09, 2009

Eliane_Yanou wrote:

Well, "myInDesign.Select 1634495520" works!!!! but not your alternative solution.

"Dim myInDesign As InDesign.Application" is not accepted neither (Robin, which is another point concerning the differences between VBS and VB6), but the point is that I have the solution to my first problem. I can now continue.

Solution:

'Select all objects

Set myInDesign = CreateObject("InDesign.Application.CS3")
myInDesign.Select 1634495520

Many thanks!

because if you want to write

  Dim myInDesign As InDesign.Application

or

  myInDesign.Select idSelectAll.idAll

in VB6 IDE - you need to make reference to TLB file with info about functions, properties and enums available from "controlled" application - when you run VBScript from InDesign - you have already correct TLB file loaded

robin

www.adobescripts.co.uk

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
New Here ,
Apr 09, 2009 Apr 09, 2009

Great! I again learned something which I didn't understand till now!

Eliane

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
Guest
Apr 09, 2009 Apr 09, 2009

Just a note: if you're going to use Dim, make sure that you comment out the line before deploying your application. It *will* cause problems if you don't.

But a better question is--why do you need to select the objects? It's possible to work with the objects without selecting them, which gives you a way to do things with all objects on all pages (something you can't do using selection).

Thanks,

Ole

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
LEGEND ,
Apr 09, 2009 Apr 09, 2009

because she want to copy objects from specified layer from one document to another

robin

www.adobescripts.com

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
Guest
Apr 09, 2009 Apr 09, 2009

Hi Robin,

Understood, but you don't need to select or copy the objects to move them from one document to another.

[I'm still getting used to this new forum software--I've lost my ability to edit posts, and it somehow thinks I've only posted twice since November!:-)]

Thanks,

Ole

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
Guest
Apr 09, 2009 Apr 09, 2009

Here's a simple example that shows how to move a page item from one document to another using Duplicate():

Set myInDesign = CreateObject("InDesign.Application.CS4")
Set myDocumentA = myInDesign.Documents.Add
Rem Run this script from the Scripts panel in InDesign,
Rem or you will need to provide the decimal equivalents
Rem for the enumerations int he following lines.
myDocumentA.ViewPreferences.HorizontalMeasurementUnits = idMeasurementUnits.idPoints
myDocumentA.ViewPreferences.VerticalMeasurementUnits = idMeasurementUnits.idPoints
Set myLayer = myDocumentA.Layers.Add
myLayer.Name = "TargetLayer"
Set myRectangle = myDocumentA.Pages.Item(1).Rectangles.Add
myRectangle.GeometricBounds = Array(72, 72, 144, 144)
myRectangle.ItemLayer = myLayer
Set myDocumentB = myInDesign.Documents.Add
myRectangle.Duplicate(myDocumentB.Pages.Item(1))

No selection, no copying.

Thanks,

Ole

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
LEGEND ,
Apr 09, 2009 Apr 09, 2009

yes ... but we are talking about copying many objects at once not one by one

and in another thread - answer to this "problem" - http://forums.adobe.com/message/1877545#1877545

robin

www.adobescripts.com

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
Guest
Apr 09, 2009 Apr 09, 2009
LATEST

Hi Robin,

Well, for whatever it's worth, I would still use duplicate, and then reestablish the text frame links after that. In my opinion, copy/paste should be reserved for cases in which there is literally *no other way* to do something.

Thanks,

Ole

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
Valorous Hero ,
Apr 09, 2009 Apr 09, 2009

Check out this script: http://www.hilfdirselbst.ch/foren/Ebenen_aus_einem_vorhandenen_Dokument_in_ein_neues_Dokument_import...

CopyFromOneDoc2Another_LayerSensitiveWithDocSelection.jsx

It’s in JS, but may be it already does what you need.

Kasyan

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