Applescript 抓取 GIF 文件位置,将其复制到剪贴板并粘贴

4

我正在尝试编写一段苹果脚本来定位、复制和粘贴图像文件。

以下代码适用于jpegspngs

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的第一帧,而不是整个文件。

有人知道这里出了什么问题吗?

1个回答

2
这在我最新版本的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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接