我需要自动化屏幕截图任务,所以我想为什么不使用automator呢?我找到了“截图”的动作,并开始玩它。问题是,它设置了文件名,当工作流再次运行时,它会覆盖之前的屏幕截图。我试着选择并重命名它,但它不起作用。本质上,我想要的是command + shift +3的正常功能,它会给它盖上日期戳或其他什么东西,任何东西都不能覆盖!!有什么想法吗?
发布于 2011-07-26 00:19:09
我设法使用了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的流行包装器中。我真的很想知道如何做到这一点,因为我从来没有能够理解鸭嘴兽。
发布于 2013-06-18 06:59:32
我从@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”操作。
https://stackoverflow.com/questions/4939656
复制相似问题