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

Is there an eventListener available when an object gets selected/deselected?

Explorer ,
Jan 30, 2019 Jan 30, 2019

Hi,

I just started with scripting and was able to build a panel that uses a .jsx to evaluate shapes and returns the results to the HTML. But for each result I would have to use a button in the HTML to fire the .jsx-function.

<a href="#" onClick="update()" id="refresh"><img src="../img/RefreshDark.svg"></a>

So update() fires a function in ExtendedScript via csInterface.evalScript(). So far so good, everything works as expected.

What I need now is firing this function in JSX whenever I select or deselect an object (path/group/compound). The eventListeners I found so far are not capable of tracking selections as far as I understand. Is there a way to imitate such a behavior as for example the info panel? Whenever I select an object it instantly updates position and size of said object. How can this be achieved for my own panel without having to click a button/link?

Thank you in advance, especially for all the old threads and tutorials you guys created on several personal sites.

1.4K
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

correct answers 1 Correct answer

Community Expert , Jan 30, 2019 Jan 30, 2019
Translate
Community Expert ,
Jan 30, 2019 Jan 30, 2019
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
Explorer ,
Jan 31, 2019 Jan 31, 2019

Thank you Carlos for your input. I already read all of those topics multiple times but I was hoping to get around using any plug-ins. I now used the AiHostAdapter and it works like a charm, so I now need to figure out how to create a hybrid extension that deploys the plug-in along with the panel.

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
Community Expert ,
Jan 31, 2019 Jan 31, 2019

This thread moved from Illustrator Scripting to Extensions / Add-ons Development and...

You can reference events in Illustrator CC SDK->Marked Object sample plugin project.

Check below page...

Adobe Illustrator CC SDK for plugins and extensions | Adobe I/O

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
Explorer ,
Jan 31, 2019 Jan 31, 2019

Ten, thank you for the info and link. I briefly checked it before and now I took a closer look. Unfortunately this is too complicated for me right now. I just filled my head with all the new "make a panel" information and the SDK way seems to be too steep of a learning curve for me right now. Maybe I'll tackle this one with the next extension but for now I am happy the AiHostAdapter got me to where the extension needed to be.

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
Guru ,
Jan 31, 2019 Jan 31, 2019

Some more links!

https://medium.com/adobetech/how-to-package-distribute-and-install-your-creative-cloud-extension-8ee...

Getting-Started-guides/Package Distribute Install at master · Adobe-CEP/Getting-Started-guides · Git...

GitHub - Adobe-CEP/Getting-Started-guides: Getting Started guides and samples for CEP extensions

Enjoy.

Take into account that the plugin might already exist in the users plugins folder from another extension.

If you could post how you deal with the hybrid it could be useful.

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
Community Beginner ,
Feb 18, 2022 Feb 18, 2022
LATEST

Yes there is, i using 

afterSelectionChanged
 
app.addEventListener("afterSelectionChanged", function(evt){
if(app.selection[0] !== undefined){
var thePageItem = app.selection[0];
// DO THE THING
}
});
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