如何获取和传递触发捕获的文本中的脚本函数调用ITERM2中的脚本函数调用?

发布于 2025-01-25 19:31:41 字数 442 浏览 4 评论 0原文

我试图添加一个触发器以某种模式捕获文本,并将其传递给

我的脚本:

#!/usr/bin/env python3
import iterm2

async def main(connection):
    @iterm2.RPC
    async def myfunc(captured_text):
        print(captured_text)

    await myfunc.async_register(connection)

iterm2.run_forever(main)

我尝试使用myfunc(capture_text:trigger.captrud_strings)在配置文件中设置触发参数。触发设置,它不起作用,并且报告了错误对未定义变量“ trigger.captrud_strings”的引用。

I was trying to add a trigger to capture text in some pattern and pass it to a Python script

My script is:

#!/usr/bin/env python3
import iterm2

async def main(connection):
    @iterm2.RPC
    async def myfunc(captured_text):
        print(captured_text)

    await myfunc.async_register(connection)

iterm2.run_forever(main)

I tried to set the trigger Parameters with myfunc(captured_text: trigger.captured_strings) in the profile trigger settings, it didn't work and the error Reference to undefined variable "trigger.captured_strings" was reported.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文