Startup script with global vars/functions

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

ronronmx

Startup script with global vars/functions

Post by ronronmx »

Hey guys,
it's been a while since I last did some photoshop scripting, and I have a question about global variables/functions...

I need to initialize some globals during startup, so that I can access them at anytime from any script once Photoshop is up and running. Now with a language like MAXScript (for 3ds max), I can put a script with a global struct in the startup folder, and the struct contains all my functions and variables I need, so from any script I can access them like so: MyStruct.MyFunction(), MyStruct.myVar etc...

Now i understand Javascript is different, and I am not experienced enough with it to figure out how to achieve the same thing, or if it's even possible...so feel free to 'enlighten' me

Thanks in advance!
Stephane
undavide

Startup script with global vars/functions

Post by undavide »

Hi Stephane,
I might be wrong, but what you're looking for are persistent sessions, which as far as I know are an InDesign feature (but not a Photoshop one).
I've tried using $.global, but to no avail.
Regards

Davide Barranca
---
http://www.davidebarranca.com
http://www.cs-extensions.com
ronronmx

Startup script with global vars/functions

Post by ronronmx »

undavide wrote:Hi Stephane,
I might be wrong, but what you're looking for are persistent sessions, which as far as I know are an InDesign feature (but not a Photoshop one).
I've tried using $.global, but to no avail.
Regards

Davide Barranca
---
http://www.davidebarranca.com
http://www.cs-extensions.com

Hi Davide, thanks for the reply. I think you're right, that's too bad because having a custom class initialized and always ready to use is nice...
What I'm doing now instead is just including the classes I need, which gives me the same functionality somewhat.

Stephane