Hi everyone,
I have a question. I'm just an HTML 5 to create panel for Photoshop. For this I use "brackets" and "Creative Cloud Extension Builder for Brackets"
I have already saved all my scripts for Photoshop which means all I need now is the panel. Unfortunately, you could call me a beginner concerning web applications and could really do with some help.
With the template which is generated when starting a new project, the file „./jsx/hostscript.jsx“ is used. I'd rather have a solution where I can access more than one file, as I have prepared one for each script. Is there the possibility to load these with a loop or something, as to enable me to access the functions via main.js?
Kindest regards, Jo
Creative Cloud Extension Builder question
- DavideBarranca
- Posts: 16
- Joined: Tue Jul 26, 2016 2:12 pm
-
- Posts: 29
- Joined: Sat Jul 30, 2016 3:52 am
- Location: San Francisco
Re: Creative Cloud Extension Builder question
Hey Jo,
Check out this other topic https://www.ps-scripts.com/viewtopic.php?f=77&t=24371
As Davide said, there are several ways of doing this.
In your hostscript, you can include other files by putting them at the top of your script like this
That will load the rest of your scripts into your hostscript. If you have functions within your other scripts, you can now call them from your hostscript like you would call any other function.
It all depends how you built your other scripts. If you built them so they run right away, without an init function or something similar, then you might want to try running the file whenever your code requires it.
For this you can use Davide's suggestion
Or executing an Action Descriptor like this.
In both scenarios you have to use the path to your script.
Hope that helps!
Check out this other topic https://www.ps-scripts.com/viewtopic.php?f=77&t=24371
As Davide said, there are several ways of doing this.
In your hostscript, you can include other files by putting them at the top of your script like this
Code: Select all
#include 'script1.jsx'
#include 'script2.jsx'
...
It all depends how you built your other scripts. If you built them so they run right away, without an init function or something similar, then you might want to try running the file whenever your code requires it.
For this you can use Davide's suggestion
Code: Select all
$.evalFile(File('~/Desktop/untitled.jsx'));
Code: Select all
function executeScript(PathToYourScript) {
var idAdobeScriptAutomationScripts = stringIDToTypeID( "AdobeScriptAutomation Scripts" );
var desc321 = new ActionDescriptor();
var idjsCt = charIDToTypeID( "jsCt" );
desc321.putPath( idjsCt, new File( PathToYourScript ) );
var idjsMs = charIDToTypeID( "jsMs" );
desc321.putString( idjsMs, "0" );
executeAction( idAdobeScriptAutomationScripts, desc321, DialogModes.NO );
}
Hope that helps!
Re: Creative Cloud Extension Builder question
I just noticed that yestarday I posted my additional answer in wrong secion :/ So I deleted all the concent and reposted it where I originally had: https://www.ps-scripts.com/viewtopic.php?f=77&t=24371
Last edited by Kukurykus on Mon Aug 08, 2016 7:30 pm, edited 1 time in total.
Re: Creative Cloud Extension Builder question
many thanks that worked wonderfully