Automator mac“截屏”问题

发布于 2024-10-16 19:19:31 字数 174 浏览 7 评论 0原文

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

I need to automate a screenshot task, so I thought why not use automator? I found the "Take Screenshot" Action and started to play with it. The problem is is that is sets the file name and when the workflow is ran again it overwrites the prior screenshot. I tried selecting this and renaming it but it wont work. Essentially what I want is the normal function of command + shift + 3 where it will date-stamp it or something, anything but overwrite!! Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空城缀染半城烟沙 2024-10-23 19:19:31

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

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 中。我真的很想知道该怎么做,因为我一直无法理解鸭嘴兽。

I managed to use screencapture and date to do something similar:

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

or something like that. You could wrap this into a shell workflow, or put it in the popular wrapper for OSX, Platypus. I'd seriously like to know how to do that, since I've never been able to understand Platypus.

匿名。 2024-10-23 19:19:31

我从@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 操作中,而不是使用“截取屏幕截图”操作。

I took the answer from @user8259 and made it more like the built-in screen capture that you normally see:

# 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}"

My version of the code includes a time-stamp in addition to the date-stamp to make it less likely that a screen-shot will overwrite a previous screen shot.

You can add this code to an Automator action called the "Run Shell Script" action instead of using the "Take Screenshot" action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文