Creative Cloud Extension Builder question

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

ChilliJoe
Posts: 4
Joined: Thu Aug 04, 2016 5:02 pm

Creative Cloud Extension Builder question

Post by ChilliJoe »

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
User avatar
DavideBarranca
Posts: 16
Joined: Tue Jul 26, 2016 2:12 pm

Re: Creative Cloud Extension Builder question

Post by DavideBarranca »

Hi Jo,
have a look here for multiple JSX embedding.
My blog has 22 articles so far on HTML Panels development (browse them all here), and if they're not enough I've released a paid course as well :-)
Cheers,

Davide Barranca
JavierAroche
Posts: 29
Joined: Sat Jul 30, 2016 3:52 am
Location: San Francisco

Re: Creative Cloud Extension Builder question

Post by JavierAroche »

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

Code: Select all


#include 'script1.jsx'
#include 'script2.jsx'
...
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

Code: Select all


$.evalFile(File('~/Desktop/untitled.jsx'));
Or executing an Action Descriptor like this.

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 );
}
In both scenarios you have to use the path to your script.

Hope that helps!
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Creative Cloud Extension Builder question

Post by Kukurykus »

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.
ChilliJoe
Posts: 4
Joined: Thu Aug 04, 2016 5:02 pm

Re: Creative Cloud Extension Builder question

Post by ChilliJoe »

many thanks that worked wonderfully