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

CEP panel shortcuts

Engaged ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Hi all,

 

I'm trying to fix a bug I have with my extension.

It consists of 2 panels. One is the Main panel.

The other is an Invisible panel that dispatches an event to the Main panel. This way I can set up a shortcut that opens the Invisible panel and triggers a function in the Main panel.

 

The Invisible panel runs this code 

 

(function copyFunction () {
    'use strict';
    var csInterface = new CSInterface();
    var event = new CSEvent("copyShortcut", "APPLICATION");
    event.data = "Copy";
    csInterface.dispatchEvent(event);
    csInterface.closeExtension();

}());

 

 ...and it works almost fine. The last command csInterface.closeExtension() though, often freezes After Effects for a few seconds (sometimes takes longer, sometimes it doesn't even freeze), which makes the whole shortcut trick a pain in the ass.

 

I've noticed a couple of things though.

First one: if in the manifest file I change these settings for the Invisible panel from

 

<AutoVisible>false</AutoVisible>
<Type>Custom</Type>

 

to

 

<AutoVisible>false</AutoVisible>
<Type>Panel</Type>

 

...nothing freezes! It runs very smooth. Nice! The drawback is that the Invisible panel is not invisible anymore. It quickly appears then disappears.

Moreover, if I keep this settings

 

<AutoVisible>false</AutoVisible>
<Type>Custom</Type>​

 

and remove the line 

 

csInterface.closeExtension();

 

the first time I open the panel it performs well (and it's invisible), but the second time (as its already open) it doesn't trigger the function (as expected) and becomes visible!! If I try to manually close it, the panel disappears but it's actually still open.

 

There is no way to both keep the panel invisible and close the panel without freezing AE.

Any help?

 

I was thinking about leaving the Invisible panel always open and find a way to trigger a function when onfocus or something... any ideas?

TOPICS
Error or problem , Freeze or hang , How to , Scripting

Views

159

Likes

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

Engaged , Mar 09, 2022 Mar 09, 2022

No worries Justin,

 

I've solved the problem!

I've created a jsx file to be put into the script folder that sends an event to the main CEP panel. Much easier and probably faster, as it doesn't require any html. 

I just didn't know that it is possible to dispatch an event without using the csInterface module.

Likes

Translate

Translate
Community Expert ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Was just going to ask, why not leave it open? If you need to constantly open and close it, would be more performant to just leave it open in the background.

Likes

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
Engaged ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

No worries Justin,

 

I've solved the problem!

I've created a jsx file to be put into the script folder that sends an event to the main CEP panel. Much easier and probably faster, as it doesn't require any html. 

I just didn't know that it is possible to dispatch an event without using the csInterface module.

Likes

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
Engaged ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

I didn't want that panel because all it does is sending the event to the main panel. It doesn't have any other use.

 

Likes

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
Community Expert ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

LATEST

Nice, yea that's a more simple solution!

Likes

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
Community Expert ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

It does sound like a CEP bug though.

Likes

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