how to group some objects and duplicate it and then enlarge the same group using javascript ??
Copy link to clipboard
Copied
I need to write a javascript which will group some object on running the script and then duplcate the same group.After duplicating it will enlarge the same group upto some extend.The object will be generally inside the textframes.We have to group them and then make a duplcate of the group on the same page.Please tell me the javascript code to do the same.
Thanks and regards,
Sanat
Copy link to clipboard
Copied
* Groups.Group add (groupItems: Array of PageItem[, layer:Layer][, at:LocationOptions=UNKNOWN][, reference:any][, withProperties:Object]) -- Creates a new Group
* PageItem Group.duplicate ([to:any][, by: Array of number]) -- Duplicates the Group at the specified location or offset
* void Group.move ([to:any][, by: Array of number]) -- Moves the Group to a new location.
* Group.absoluteHorizontalScale, Group.absoluteVerticalScale -- The horizontal and vertical scale of the Group relative to its containing object.
(All copied straight out of the CHM version of the ESTK Help, created by me and put into CHM by ABC GREEN. HTML version somewhere at the same location.)
Copy link to clipboard
Copied
Could u please post the javascript code for the same.
Thanks in advance..
Copy link to clipboard
Copied
You say:
>which will group some object on running the script
Do you mean "some objects"? Hope so because you can't group a single item.
How does the script know which objects to work on? Are you requiring the user to select them in advance? If not, what technique should the script use to know which objects?
>it will enlarge the same group upto some extend
To which extent?
>The object will be generally inside the textframes
What does "inside" mean? Are you talking about anchored objects? Or is this a reference to their geometric positions on the page? If the latter, what does the text frames have to do with anything? If the former, then the job just got a whole lot harder because you can't group anchored objects.
Dave
Copy link to clipboard
Copied
>I need to write...
rhyme with
>post the code
? It's not as if it's a well-known or easy "trick" -- or as if you've given clear objectives (see Dave's list of questions).
Did you check the functions I summed up in the ESTK? These are the ones you will be using, or at least, that's what I'm guessing you should. What have you got so far?
Copy link to clipboard
Copied
The extent of enlargement will be fixed.We can specify the geometric position in the script itself.
I m a beginner to indesign javascript.Plz anyone help me in the code.
Regards,
Sanat
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It doesn't help you keep asking for useful snips (or entire scripts) of things that are
i difficult
because I have to tell you what they do, where to insert them, and how to change. I might as well send a complete and totally custom script; and then you learned nothing at all (you'd learn my bank account number).
Copy link to clipboard
Copied
Thanks,
Sanat
Copy link to clipboard
Copied
Make jongware an offer he can't refuse.
Peter
Copy link to clipboard
Copied
Again i am seeking help from u guys for solving this script.Waiting 4 ur positive response.
Copy link to clipboard
Copied
Dave Saunders, in his JS blog, simply uses
>myParent.groups.add(gpArray)
-- then again, he was using CS2 there.
I tried numerous variations for about three consecutive hours (my boss doesn't read this forum), but the best I got was finding out
>var myGroup = app.activeDocument.groups.add(app.selection,null,LocationOptions.AT_BEGINNING,app.activeWindow.activePage); // NOT app.documents!
complains about 'no parent'. The location is optional; yet, if you omit it, you get another error.
I found Dave's page with some google-fu: Google groups site:jsid.blogspot.com has a few more hits. I didn't read them all, but I think you should.
Or make Dave an offer he can't refuse.
Copy link to clipboard
Copied
Dave
Copy link to clipboard
Copied
See some comparable problems and how much they make when solved.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
myArray = myPage.pageItems.everyItem().getElements();
myPage.groups.add (myArray)
Peter
Copy link to clipboard
Copied
You might take a look at the documentation script Group.jsx--it's in the archive on the InDesign scripting home page.
Thanks,
Ole
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I still haven't found out why
>app.activeDocument.groups.add(myObjectList);
keeps on failing on my system ... I'll try your script (after the weekend :-)), perhaps it was just a typo on my side.
Copy link to clipboard
Copied
Dave
Copy link to clipboard
Copied
The abhove code is working fine in cs3 but is not working in cs2.
Could anyone give me the cs2 version of the same code.
Its duplicating the group but not enlarging after duplicatiing.I m using absolutehorizontal and vertical scale for enlargeing the group but it is not enlargeing the text inside that.
Thanks,
Sanat

