Processor script with selection aspect ratio alert

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

jtredinn

Processor script with selection aspect ratio alert

Post by jtredinn »

Hi all!
I've been referencing this forum for a while now and just now have come across a problem that I need help with.
I'm working on creating a processor script that will alert the me (and stop the script) when the marquee selection is not at my desired fixed ratio. I create a marquee with fixed ratio of 336x596, but if for some reason do not have my marquee set to this size at processing, I want the script to alert me. I have it set now but can't figure out how to assign it to only warn me if the marquee is not this specific fixed ratio. Because my image sizes are not consistant and I do not want to crop, just want to marquee, I can't figure this out.
Any ideas???

Thanks in advance!

JT

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Stitches

Processor script with selection aspect ratio alert

Post by Stitches »

I haven't seen any elegant solutions in javascript equivalent to an exit or abort. What you could do is just tell javascript to run a function that doesn't exist. It will error, but it'll also stop:

Code: Select allif (app.activeDocument.selection.bounds[2] - app.activeDocument.selection.bounds[0] != 336 || app.activeDocument.selection.bounds[3]-app.activeDocument.selection.bounds[1] != 596){
    var look = confirm('Something has gone terribly wrong. Do you want to continue?')
    if(!look){
        exit();
    } 
}