我正在尝试编写一个苹果脚本来定位、复制和粘贴图像文件。
以下代码适用于jpegs
and pngs
:
set thePath to "file_location"
set the clipboard to (read thePath as «class PNGf») # [1]
tell application "System Events" to keystroke "v" using command down
当我将其更改为GIF
格式,它不起作用:
set thePath to "file_location"
set the clipboard to (read thePath as GIF picture) # [1]
tell application "System Events" to keystroke "v" using command down
相反,它会抓取第一帧GIF
,而不是entire file.
有谁知道这里出了什么问题吗?
这对我在最新版本的 mac OS High Sierra 上有效。
set thePath to "/Library/Desktop Pictures/Abstract.jpg"
-- set the clipboard to a file (this only works with a single file or folder)
set the clipboard to POSIX file thePath
delay 1
tell application "System Events" to keystroke "v" using command down
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)