使用Command-Control-Shift-4,可以截取屏幕截图区域,然后将其保存到剪贴板.我想知道是否可以从Python内部实现同样的功能.理想情况下,可以指定图像文件格式以及在Python中以编程方式将其全部保存在何处.有任何想法吗?
我找到applescript
了几乎所需要的东西,除了这个脚本捕获整个屏幕.我想将其限制在一个地区.
tell application "System Events" keystroke (ASCII character 36) using {command down} delay 1 keystroke space end tell
下面的苹果脚本可以很好地捕获区域屏幕(仍然无法控制捕获图像的保存位置(默认情况下保存到用户的桌面).
tell application "System Events" keystroke (ASCII character 36) using {command down} key code 4 using {command down, shift down} end tell
问题是如何自定义输出文件路径位置...