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

animate extenstions api

New Here ,
Oct 10, 2018 Oct 10, 2018

Copy link to clipboard

Copied

in zxp archive i have *.apr file (publish profile) and want to use document.importPublishProfile( fileURI ) to import this profile, but i can't get extension working directory to generate fileURI.

how can i get extension working dir, or any ways do what i want ?

Views

654

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 Employee , Oct 29, 2018 Oct 29, 2018

For CEP extensions, you can use CSInterface APIs to get the extension's root-

     var cs = new CSInterface();

     var extensionPath = cs.getSystemPath(SystemPath.EXTENSION);

For other extensions, you can use either of the ways suggested above:

     Extensions folder location: an.configURI +"/extensions/";

     Jsfl script location: an.scriptURI

Votes

Translate

Translate
Community Expert ,
Oct 10, 2018 Oct 10, 2018

Copy link to clipboard

Copied

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
LEGEND ,
Oct 10, 2018 Oct 10, 2018

Copy link to clipboard

Copied

fl.configDirectory

Description

Read-only property; a string that specifies the full path for the local user’s Configuration directory in a platform-specific format. To specify this path as a file:/// URI, which is not platform-specific, use fl.configURI.

Example

The following example displays the Configuration directory in the Output panel:

fl.trace("My local configuration directory is " + fl.configDirectory);

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
New Here ,
Oct 11, 2018 Oct 11, 2018

Copy link to clipboard

Copied

ok, i have config dirrectory. how can i get extension dirrectory ?

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
LEGEND ,
Oct 11, 2018 Oct 11, 2018

Copy link to clipboard

Copied

That IS the extension directory.

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
New Here ,
Oct 12, 2018 Oct 12, 2018

Copy link to clipboard

Copied

no.. this is config directory.

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
LEGEND ,
Oct 12, 2018 Oct 12, 2018

Copy link to clipboard

Copied

Galphimbl  wrote

no.. this is config directory.

The config directory is where extensions are installed. If you have an extension that adds command scripts, it would put them in Configuration/Commands. If an extension adds code snippets, they go in Configuration/CodeSnippets. Etc.

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
New Here ,
Oct 16, 2018 Oct 16, 2018

Copy link to clipboard

Copied

QUESTION: how can i get full path to custom-profile.apr ?

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
New Here ,
Oct 12, 2018 Oct 12, 2018

Copy link to clipboard

Copied

ok... again...

i have already installed extension.

my extension folders structure.

./

--client

----index.html

--host

----index.jsx

--publish-profiles

----custom-profile.apr

what i want...?

from index.jsx run code

fl.getDocumentDOM().importPublishProfile("../publish-profile/custom-profile.apr");

but... if i run this code i have error "Error: importPublishProfile: Argument number 1 is invalid";

i know why i have this error... because i need fileURI

then i try another code

fl.getDocumentDOM().importPublishProfile("file:///../publish-profile/custom-profile.apr");

and i have same error again.. because i need full path....

QUESTION: how can i get full path to custom-profile.apr ?

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
Community Expert ,
Oct 12, 2018 Oct 12, 2018

Copy link to clipboard

Copied

Hi.

Use fl.scriptURI and then manipulate the full string path to access the file you want. Like this:

fl.getDocumentDOM().importPublishProfile(fl.scriptURI.replace("host/" + fl.scriptURI.split("/").pop(), "publish-profiles/custom-profile.apr"));

Regards,

JC

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
New Here ,
Oct 16, 2018 Oct 16, 2018

Copy link to clipboard

Copied

thanks for answer, but... one thing went wrong....

alert("[" + fl.scriptURI + "]"); // alerts "[unknown:]"

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
Community Expert ,
Oct 16, 2018 Oct 16, 2018

Copy link to clipboard

Copied

Is your script file saved?

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
New Here ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

yes, it's signed and installed CEP extension..

when i run script from commands, it returns valid URI...

but from extension "unknown:" (((

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
Community Expert ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

This is odd.

fl.scriptURI should return the location of the script file no matter where it is.

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
New Here ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

any other ideas ?

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
Community Expert ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

Would you mind sharing your project? You can remove important parts/files if you wish. Just leave the minimum structure so I can test if I can get the jsx file path.

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
New Here ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

https://www.dropbox.com/s/2v45fsgg6vbbv2j/extension.zip?dl=0

you can try...

to start project you need install nodeJS

open command prompt / terminal

go to project dir

run - npm install

run - "node_modules/.bin/gulp" --gulpfile "gulpfile.js" build-debug

after any changes use last command. it build -> sign -> install extension

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
Community Expert ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

Thanks a lot.

I haven't run you project yet but I noticed that you don't have a .jsx file. All JSAPI commands like fl.scriptURI will only work if they are coming from a .jsx file.

You could, for example, create a file called index.jsx within the host folder and in this file you could write something like this:

function getScriptPath()

{

     var scriptURI = fl.scriptURI;

     fl.trace(scriptURI);

     return scriptURI;

}

Then in your client JavaScript file (say index.js) you could use:

csInterface.evalScript("getScriptPath()");

For more info, please see this guide:

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

Regards,

JC

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
New Here ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

file src -> host -> index.tsx compiled into output- > host -> index.jsx

all compiled structure you can see in output folder.

also in this folder you can find extension.zxp that installed into Adobe Animate.

you can open extension.zxp to lookup structure using 7-zip for example

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
New Here ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

any ideas ?

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
Adobe Employee ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

For CEP extensions, you can use CSInterface APIs to get the extension's root-

     var cs = new CSInterface();

     var extensionPath = cs.getSystemPath(SystemPath.EXTENSION);

For other extensions, you can use either of the ways suggested above:

     Extensions folder location: an.configURI +"/extensions/";

     Jsfl script location: an.scriptURI

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
New Here ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

LATEST

thanks a lot, your solution really works.

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