Cannot get or set the window size of some apps using AppleScript?

If the application is not scriptable, you won't be able to get this kind of information from it. If you have the System Preferences > Accessibility preference for "Enable access for assistive devices" set, you may be able to use the System Events processes suite to get/set the window size, for example:

tell application "System Events" to tell application process "Angry Birds Space"
    get size of window 1
end tell

Note: Enabling accessibility varies gravely between macOS versions. How to Enable Accessibility on Mac OS X is a good guide. As of 10.14, you have to go to Security & Privacy > Accessibility option > Privacy tab and add the application in the "Allow the apps below to control your computer".


Is Angry Birds Space scriptable? If not, telling it do anything should not work. A similar example would be:

tell application "Preview" to get the bounds of the window 1

As Red Menace points out, you can use the application process like this:

tell application "System Events" to tell application process "Preview"
    tell window 1
        set {size, position} to {{1280, 800}, {50, 50}}
    end tell
end tell

Tags:

Applescript