我正在尝试录制屏幕演示,为此,我希望每次记录VSCode窗口时都以相同的大小记录。 为此,我尝试使用自动化脚本调整窗口大小。 它在我测试过的所有应用程序中都有效,但在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大小时发生的错误。有人知道这个错误可能是什么吗?或者有人知道其他强制窗口大小的方法吗?