0

我需要自动化截屏任务,所以我想为什么不使用 automator?我找到了“截屏”动作并开始使用它。问题是它设置了文件名,当再次运行工作流时,它会覆盖之前的屏幕截图。我尝试选择它并重命名它,但它不起作用。本质上,我想要的是 command + shift + 3 的正常功能,它会在它上面加上日期标记或其他东西,除了覆盖之外的任何东西!有任何想法吗?

4

2 回答 2

1

我设法使用屏幕截图和日期来做类似的事情:

fdate=$(date +"$m$d$Y") #I formatted time as mmddyyyy. You can use other formats, add dashes, etc.
screencapture -iW ~/$fdate.png   #outputs file at ~/mmddyyyy.png

或类似的东西。您可以将其包装到 shell 工作流程中,或者将其放入流行的 OSX 包装器 Platypus 中。我真的很想知道如何做到这一点,因为我从来没有能够理解鸭嘴兽。

于 2011-07-25T16:19:08.710 回答
0

我从@user8259 那里得到了答案,让它更像你通常看到的内置屏幕截图:

# We'll use the default format for the time-stamp
# This could be improved to be more like the Mac's built-in
# screen-shot with yyyy-mm-dd at hh.mm.ss AM/PM
# you would just have to figure out the date-time formatting
# in this shell script.
theTime=`date`

# create the file name for the screen-shot
theFileName="$HOME/Desktop/Screenshot $theTime.png"

#outputs file on the Desktop with a timestamp
screencapture "${theFileName}"

我的代码版本除了日期戳之外还包括一个时间戳,以降低屏幕截图覆盖以前的屏幕截图的可能性。

您可以将此代码添加到名为“Run Shell Script”操作的 Automator 操作中,而不是使用“Take Screenshot”操作。

于 2013-06-17T22:59:31.970 回答