Automator mac“Take Screenshot”问题

时间:2011-02-08 23:19:35

标签: automator

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

2 个答案:

答案 0 :(得分:1)

我设法使用screencapture和date做类似的事情:

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的流行包装器中。我真的很想知道怎么做,因为我从来没有能够理解鸭嘴兽。

答案 1 :(得分: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}"

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

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