这是用户在 2024-5-6 9:42 为 https://blog.routinehub.co/method-for-copy-paste-actions-on-shortcuts/ 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Revolutionizing Shortcuts: a Game-Changing Method for Copy/Paste Actions

Revolutionizing Shortcuts: a Game-Changing Method for Copy/Paste Actions

The Apple Shortcuts community never fails to impress, and this time an extremely important discovery has been made by @dotdev (on Routinehub and Discord), which could change the rules of the game.
Apple Shortcuts 社区总是给人留下深刻的印象,这次 @dotdev(在 Routinehub 和 Discord 上)做出了一个极其重要的发现,这可能会改变游戏规则。

In simple terms, they have managed to find a method to create shortcut actions that can paste actions directly into any shortcut without the need to signing.

Rather than an article, this will be a collection of quotes, so as not to detract from the credit due to the protagonists of this story.

It all started with a question from the user @spenpal on Discord, with the following query:
这一切都始于 Discord 上用户 @spenpal 的一个问题,其中包含以下查询:

Is it possible to make a shortcut that copies a shortcut action to your clipboard? For example, I would like to automatically copy a Dictionary action that has a predefined key and value.

I could just make a shortcut with the a Dictionary action and manually copy it, but I’d like to add variations, which will get tedious to manually copy everytime. So, it would be nice with a press of a shortcut, it automatically copies to my clipboard.

To which @dotdev responded with evidence of the functionality of their method:
@dotdev 对此做出了回应,并提供了其方法功能的证据:

According to @dotdev, this is how it works:
根据 @dotdev 的说法,它是这样工作的:

Basically when you copy an action manually then set clipboard to .plist it will show the underlying structure that makes up the action that got copied to the clipboard the reason the shortcuts app is able to understand what the plist data is meant to represent is via the uniform type identifier (UTI) which is what apple uses besides file extensions to understand how to work with certain files.
基本上,当您手动复制操作然后将剪贴板设置为 .plist 时,它将显示构成复制到剪贴板的操作的底层结构,快捷方式应用程序能够理解 plist 数据含义的原因是通过统一类型标识符(UTI),除了文件扩展名之外,苹果还使用它来了解如何处理某些文件。

In this case when you copy an action to the clipboard the shortcuts app gives it a UTI of com.apple.shortcuts.action so when you paste it into shortcuts it understands that the plist data is a shortcuts action
在这种情况下,当您将操作复制到剪贴板时,快捷方式应用程序会为其提供 com.apple.shortcuts.action 的 UTI,因此当您将其粘贴到快捷方式时,它会理解 plist 数据是快捷方式操作
That since there's no way of natively setting or checking the UTI of a file you need to get the actions app which provides the actions to do so.
由于无法本地设置或检查文件的 UTI,因此您需要获取提供操作的操作应用程序来执行此操作。
Once you have the plist of the shortcut dictionary action, you can just paste it as text and use it instead of getting clipboard.
获得快捷方式字典操作的 plist 后,您可以将其粘贴为文本并使用它,而不是获取剪贴板。

For an easier understanding, @mvan231 (ShortCasts) (on Routinehub and discord ) took the time to elaborate on the steps to follow in a simple and organized way:
为了更容易理解,@mvan231 (ShortCasts)(在 Routinehub 和 Discord 上)花时间以简单且有组织的方式详细说明了要遵循的步骤:

  • In source shortcut surround actions you want in repeat 1 time action
    在源快捷方式环绕操作中您想要重复 1 次操作
  • Go to destination shortcut
  • Hit the share button in the shortcut editor of the destination shortcut and run Shortcut Source Tool from the share sheet (the passed iCloud link isn't actually doing anything)
    点击目标快捷方式的快捷方式编辑器中的共享按钮,然后从共享表中运行快捷方式源工具(传递的 iCloud 链接实际上没有执行任何操作)
  • Select the source shortcut that you added the repeat 1 time action(s) in
    选择您在其中添加重复 1 次操作的源快捷方式
  • Select the menu option to copy actions to clipboard
  • Shortcut finishes and now you can paste at your desired location within the shortcut you're already in

Without a doubt, my mind was blown when I learned about this method from @mvan231 and the post by @gluebyte on Automators.
毫无疑问,当我从 @mvan231 和 @gluebyte 在 Automators 上发表的帖子中了解到这种方法时,我大吃一惊。

Certainly, all of this is revolutionary and lays the groundwork for finding new methods to create shortcuts from other languages and then convert them into workflows. I'm eager to make the most of it and see what else the Apple Shortcuts community can achieve.
当然,所有这一切都是革命性的,并为寻找新方法从其他语言创建快捷方式然后将其转换为工作流程奠定了基础。我渴望充分利用它,看看 Apple Shortcuts 社区还能实现什么目标。

1 comment 1条评论