Hi everybody,
First post here!
Im not that tech savvy but with the help of chatGPT i managed to build one or two fully functioning scripts that serve my purposes.
My first question is the following:
I am trying to make the script have a GUI where it asks the user to select some options in the form of buttons.
One of the options is to edit an smart_object content.
meaning, the script will open the smart_object specified by name.
the issue im encountering is that once the script takes the user (me) inside the smart object, other actions keep running and i need it to wait until I either save or close the new smart object window.
ChatGPT says it doesnt know or there is no way as of now for Photoshop to listen, understand or to flag when the user saves or closes the smart object window.
It offered a solution which was to use a timer, but when i try that function, it simply freezes and have to close photoshop in order to continue.
This is the function it is suggesting.
// This function sets a timer to repeatedly call checkSmartObjectClosure
function waitForSmartObjectClosure() {
if (!smartObjectClosed) {
checkSmartObjectClosure();
$.sleep(1000); // Wait for 1 second before checking again
waitForSmartObjectClosure();
} else {
callback();
}
}
All i want is to know if there is a way to make it within an script that it must wait for me to save/close the smart object content window and then for it to continue?
if there is, what function should I use? if not,can this be achieved in any other way?
Basically, the script is looping and replacing some images from a source folder and putting them on the smart object, but for some i want to edit them a bit and then after that i want it to continue the process.
Hope this makes sense.
Is this possible? can we create a listener or something? I know chatGPT is not the best but its what i got and if i provide the right resource i can make it happen with your help! Thanks!