Can't reference AIHostAdapter.aip in CEP

Community Beginner ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

I have placed AIHostAdapter.aip in the plugins/Extensions folder and it is listed in AI System info.

When running the below code I get AIEventAdapter is not defined error. How can I reference to it from CEP extension? I wonder could you please tell me how it works?

AIEventAdapter.getInstance().addEventListener(
AIEvent.ART_SELECTION_CHANGED,
function(eve) {
alert(eve.type +" invoked.");
}
)});

TOPICS
How to, Scripting, SDK, Third party plugins

Views

162

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

Adobe Community Professional , Oct 28, 2021 Oct 28, 2021
Hi, You need to use following AIEventAdapter.getInstance().addEventListener( AIEvent.ART_SELECTION_CHANGED, function (eve) { alert(eve.type + " invoked."); } ); No round brackets after AIEventAdapter. Let us know if that works for you.

Likes

Translate

Translate
Adobe Community Professional ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Hi,

Did you include the hostadapter js file?

 

Best regards

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 Beginner ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Thanks for response.
No, I am trying to get it working for the first time and could not find it to download (links in the forums are dead). Could you please share it?

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
Adobe Community Professional ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Here is the link to download the file

https://www.dropbox.com/s/p0w5o2rhvb7bz5r/cs_host_adapter-2.0.js?dl=0

 

Include in your project and give path of this file into your html, the way you load other js files.

Best regards

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 Beginner ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Thank you. Here is the relevent content in my files:

index.html

<script type="text/javascript" src="cs_host_adapter-2.0.js"></script>

index.js

AIEventAdapter().getInstance().addEventListener(
AIEvent.ART_SELECTION_CHANGED,
function (eve) {
alert(eve.type + " invoked.");
}
);

I am not sure what I am doing wrong but unfortunately I am getting the below error:

Uncaught TypeError: this.initQualifiedEventName is not a function
at EventAdapter (file:///C:/Program%20Files%20(x86)/Common%20Files/Adobe/CEP/extensions/Export_panel/client/cs_host_adapter-2.0.js:24:39)
at AIEventAdapter (file:///C:/Program%20Files%20(x86)/Common%20Files/Adobe/CEP/extensions/Export_panel/client/cs_host_adapter-2.0.js:901:15)
at file:///C:/Program%20Files%20(x86)/Common%20Files/Adobe/CEP/extensions/Export_panel/client/index.js:29:1

Any help would be greatly appreciated

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
Adobe Community Professional ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Please share your code.

Best regards

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 Beginner ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

I uploaded the extension (nearly blank, just started) to https://drive.google.com/file/d/1wFFxSB7rAUVHOYuCYK62CZ81XZv2nfMU/view?usp=sharing

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
Adobe Community Professional ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Hi,

You need to use following

AIEventAdapter.getInstance().addEventListener(
  AIEvent.ART_SELECTION_CHANGED,
  function (eve) {
    alert(eve.type + " invoked.");
  }
);

 

No round brackets after AIEventAdapter.

Let us know if that works for you.

Best regards

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 Beginner ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Yes, it worked! Thank you very much! 

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
Contributor ,
Dec 04, 2021 Dec 04, 2021

Copy link to clipboard

Copied

LATEST

Hi,

I am also looking for that js file. The dropbox link is no longer valid

 

many thanks

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