如何将字符串数组传递到苹果脚本列表,以便可以在 Macos 上迭代这些值?

发布于 2025-01-15 18:49:42 字数 357 浏览 3 评论 0原文

如果我有一个使用 swift 的数组,看起来像 var array = ["james", "tom", "luke"]

我怎样才能把这个数组转换成苹果脚本列表或能给我的东西能够使用数组中的值并使用苹果脚本对其进行迭代。

我当前的代码是

let applescriptToOpen = """
     repeat with t in \(array)
         tell application "Google Chrome"
             print value of t
         end tell
      end repeat
     """

代码示例将不胜感激。

If I have an array using swift that looks like var array = ["james", "tom", "luke"]

how could I convert this array into an apple script list or something that would give me the ability to use the values from the array and iterate over them with apple script.

My current code is

let applescriptToOpen = """
     repeat with t in \(array)
         tell application "Google Chrome"
             print value of t
         end tell
      end repeat
     """

A code example would be much appreciated.

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

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

发布评论

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

评论(1

白况 2025-01-22 18:49:42

使用 AppleScript-ObjC 桥接器。

Use the AppleScript-ObjC bridge.

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