In my efforts to learn AppleScript, I’ve started to play with window sizing. Between here and other sources I was able to put together a script that sizes a window to what I’d like.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events" to tell process "Bean"
set position of window 1 to {1, 25}
set size of window 1 to {1152, 1152}
end tell
Also, I have a simple script that will launch an application.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Finder"
activate
open application file "Bean.app" of folder "Applications" of startup disk
end tell
But, when I try to put them together like so.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Finder"
activate
open application file "Bean.app" of folder "Applications" of startup disk
end tell
tell application "System Events" to tell process "Bean"
set position of window 1 to {1, 25}
set size of window 1 to {1152, 1152}
end tell
I get an error “System Events got an error: Can’t set process “Bean” to {1, 25}.”
Any ideas on why they will work separately but not when combined?