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 ?
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
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
ok, i have config dirrectory. how can i get extension dirrectory ?
Copy link to clipboard
Copied
That IS the extension directory.
Copy link to clipboard
Copied
no.. this is config directory.
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.
Copy link to clipboard
Copied
QUESTION: how can i get full path to custom-profile.apr ?
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 ?
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
Copy link to clipboard
Copied
thanks for answer, but... one thing went wrong....
alert("[" + fl.scriptURI + "]"); // alerts "[unknown:]"
Copy link to clipboard
Copied
Is your script file saved?
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:" (((
Copy link to clipboard
Copied
This is odd.
fl.scriptURI should return the location of the script file no matter where it is.
Copy link to clipboard
Copied
any other ideas ?
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.
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
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
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
Copy link to clipboard
Copied
any ideas ?
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
Copy link to clipboard
Copied
thanks a lot, your solution really works.