colindunn
colindunn

Reputation: 3163

Check for multiple screen resolutions

How would I modify this script to look for images for multiple screen resolutions? Right now it checks for a single screen resolution (640x1136), but I would like to also check for 640x960 and 1024x768.

on run {input, parameters}

    set picFolder to alias "Users:colind:Dropbox:Camera Uploads:"
    set screenshotFolder to alias "Users:colind:Dropbox:Camera Uploads:Screenshots:"

    tell application "System Events"
        set photos to path of files of picFolder whose kind is "Portable Network Graphics image"
    end tell

    set screenshots to {}
    repeat with imgPath in photos
        set imgAlias to alias imgPath
        tell application "Image Events"
            set img to open imgPath
            if dimensions of img = {640, 1136} then
                set end of screenshots to imgAlias
            end if
            close img
        end tell
    end repeat

    tell application "Finder"
        move screenshots to screenshotFolder
    end tell


    return input
end run

Upvotes: 0

Views: 56

Answers (1)

CRGreen
CRGreen

Reputation: 3444

You should be able to change the if line to:

if ((dimensions of img = {640, 1136}) or (dimensions of img = {640, 960}) or (dimensions of img = {1024, 768}) ) then

Upvotes: 1

Related Questions