Events, open document, and in-script event handlers
Hey guys, I'm new to scripting in Photoshop and could use some help using events.
I need a script to open some files and copy some layers between them. Unfortunately, when using file.execute to open them (file.open doesn't seem to work, despite returning true), the documents aren't ready by the time my script references them.
So I have to wait for an open document event to fire.
Is there a way to set up an event listener that will call a function in the same script? I need access to variables in my main script, so calling an external script as an event handler isn't super useful anyways.
That being said, I went ahead and tried app.notifiers.add("Opn ", new File(scriptPath + "ExternalEventHandlerScript.jsx")); anyways, and that was misbehaving as well - it won't work the first time I run the script - the errors out with "Notifier already installed". But if I then remove the code and run the script from my panel again, the external event handler will run properly.
TLDR: Is there a way to set up an event listener that will call a function in the same script? I need access to variables in my main script, so calling an external script as an event handler isn't super useful anyways.
