如何通过AppleScript将Photoshop CC窗口大小设置为1280x720?

时间:2014-01-06 17:51:19

标签: applescript photoshop

我正在尝试将Photosshop CC窗口调整为1280x720以将其记录在720p中。我试过多种方法,包括AppleScript,SizeUP!应用程序,终端等,但没有工作。

以下是我正在使用的AppleScript示例:

tell application "System Events" to tell application process "Adobe Photoshop CC" 
    display dialog (get name of window 1) 
    set position of window 1 to {50, 50}   
    set size of window 1 to {1280, 720} 
end tell

它确实设置了位置,但没有设置应用程序窗口的大小。

当我尝试

tell application "System Events" to tell application process "Adobe Photoshop CC"
           tell window 1
            set {size, position} to {{1280, 720}, {150, 150}}
            end tell end tell

我收到错误"System Events got an error: Can’t set application process \"Adobe Photoshop CC\" to {1280, 720}." number -10006 from application process "Adobe Photoshop CC"

我还尝试使用以下代码设置边界而不是大小,但无济于事。

set the_application to "/Applications/Adobe Photoshop CC/Adobe Photoshop CC.app"
tell application the_application
    activate
    set bounds of window 1 to {1, 1, 1281, 721}
end tell

我得到"Adobe Photoshop CC got an error: Can’t set window 1 to {1, 1, 1281, 721}." number -10006 from window 1

SizeUP!应用程序确实改变了位置但不影响Photoshop窗口大小。

有谁知道如何在Mac上将Photoshop应用程序窗口调整为1280x720以将其记录在720p?

谢谢!

1 个答案:

答案 0 :(得分:0)

这适用于我使用最新版本的macOS High Sierra和Adobe Photoshop CC 2017

set thePosition to {0, 20}
set theSize to {1280, 720}
set theBoundz to {thePosition} & {theSize}

tell application "Adobe Photoshop CC 2017" to activate
delay 0.1
tell application "System Events" to tell window 1 of ¬
    (process 1 whose it is frontmost) to set {position, size} to theBoundz