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

Can I take the running script off the hook and re-enable it when I give commands with groups of items.

Participant ,
May 26, 2017 May 26, 2017

Copy link to clipboard

Copied

I have anchored grouped items in the story. I want to get them out of the story and get them out of the group. After I have done a few operations by hand, I want to group again and get to the anchored place. Is it possible to do it with a single script?

Scrip to do that?

- anchored group from group.

- I will untie the group and do a few things. (In this case the script will remain inactive)

- When I do it with the group again, the script will be active and it will be positioned at the previous anchored position.

EXAM.jpg

Thank you for your ideas.

TOPICS
Scripting

Views

351

Translate

Translate

Report

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

Community Expert , May 27, 2017 May 27, 2017

Hi,

I don't know how your level of expertise is with scripting.


If you want to put all functionality in one single script run once* you have to work with event listening.
Basically that's a mechanism that would watch things you do. In your case with groups of a particular story and the items of that group once it is ungrouped. And if one or all of the items is or are grouped again ( that would be a logical entry point for doing something automatically after a first step ).

*And you could build this

...

Votes

Translate

Translate
Community Expert ,
May 27, 2017 May 27, 2017

Copy link to clipboard

Copied

Hi,

I don't know how your level of expertise is with scripting.


If you want to put all functionality in one single script run once* you have to work with event listening.
Basically that's a mechanism that would watch things you do. In your case with groups of a particular story and the items of that group once it is ungrouped. And if one or all of the items is or are grouped again ( that would be a logical entry point for doing something automatically after a first step ).

*And you could build this one script as a toggle.
Run it once it would be activated. Run it a second time activities will stop, the listeners would be removed.

Way easier—perhaps 1 % in effort compared to the event listening approach—you could work with at least two scripts.


1. One that is running on the selected anchored group.
Perhaps doing a duplicate of the group and ungroup the duplicate.


2. And one that you are running on the selected group on the page after you finished what you like to do.

That script would exchange the anchored group with the selected group on the page.

You could even have a third script, that would be run after the second one:

3. Select the next anchored group in the story.

All three scripts would run in the same target engine so they could share functions and declared variables only for the scripts using that engine. What a target engine statement is? See here on page 9:

https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs5_docs/indesign_scripting/feature-devel...

A tiny example:

Storing Data In A Target Engine · fabianmoronzirfas/extendscript Wiki · GitHub

If you need a user interface for running the scripts see Peter Kahrel:

ScriptUI for dummies | Peter Kahrel

Regards,
Uwe

Votes

Translate

Translate

Report

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 ,
May 28, 2017 May 28, 2017

Copy link to clipboard

Copied

Laubender  wrote

Hi,

I don't know how your level of expertise is with scripting.


If you want to put all functionality in one single script run once* you have to work with event listening.
Basically that's a mechanism that would watch things you do. In your case with groups of a particular story and the items of that group once it is ungrouped. And if one or all of the items is or are grouped again ( that would be a logical entry point for doing something automatically after a first step ).

*And you could build this one script as a toggle.

Way easier—perhaps 1 % in effort compared to the event listening approach—you could work with at least two scripts.


1. One that is !running on the selected anchored group.
Perhaps doing a duplicate of the group and ungroup the duplicate.


2. And one that you are running on the selected group on the page after you finished what you like to do.

That script would exchange the anchored group with the selected group on the page.

You could even have a third script, that would be run after the second one:

3. Select the next anchored group in the story.

Thanks Uwe I think the second way is more understandable for me. I completed the first and second steps. Step 3 is hard for me.

#targetengine "session01"

myObjem=app.selection[0];

myObjem1=myObjem.duplicate();

        myObjem1.move([-14,14]);

                        try{

            myObjem1.ungroup();

            }catch(e){};

Votes

Translate

Translate

Report

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 ,
May 28, 2017 May 28, 2017

Copy link to clipboard

Copied

LATEST

"target engine" my problem solved. Thanks Laubender

Votes

Translate

Translate

Report

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