【发布时间】:2020-03-28 13:18:32
【问题描述】:
我正在尝试进行截屏,为此,我想每次都以相同大小记录 VSCode 窗口。为此,我尝试使用 Automator 脚本来调整窗口大小。它适用于我测试过的所有应用程序,但不适用于 VSCode。
这是脚本:
(* This AppleScript will resize the current application window to the height specified below and center it in the screen. Compiled with code from Natanial Wools and Amit Agarwal *)
set the_application to (path to frontmost application as Unicode text)
set appHeight to 720
set appWidth to 1280
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
tell application the_application
activate
reopen
set yAxis to (screenHeight - appHeight) / 2 as integer
set xAxis to (screenWidth - appWidth) / 2 as integer
set the bounds of the first window to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}
end tell
这是我尝试调整 VSCode 大小时发生的错误。有谁知道这个错误可能是什么?或者有谁知道任何其他强制窗口大小的方法?
【问题讨论】:
标签: macos visual-studio-code automator