为什么不能将我的变量传递给 applescript?
Why can't pass my variable to applescript?
屏幕截图显示了我是如何尝试执行此操作的。我似乎无法将捕获的变量传递给 applescript。我是 applescript 的新手,所以很可能是一些非常基本的东西让我感到困惑。
基本语法之类的。目前传递的是文本'(input02)',而不是变量。
用谷歌搜索,没有运气。有什么想法吗?
我发现 Automator workflow 和 AppleScript [= OP 中的 33=]代码。
在AppleScript代码中:
在第二个 运行 AppleScript action 中,OP 中包含的图像中,代码应该如下:
on run {input, parameters}
set input02 to (input as text)
delay 2
tell application "Google Chrome"
execute front window's active tab javascript ¬
"document.getElementById('title').value = '" & input02 & "';"
execute front window's active tab javascript ¬
"document.getElementById('wmd-input').value = 'body copy goes here';"
end tell
end run
- 在第一个
execute
行中,'(inputs02)'
被改成'" & input02 & "'
,从而让它实际上通过了[=33= input02
变量的]值。正如最初编码的那样,它传递的是文字 input02
而不是 input02
变量 的 值 因为它被捕获了两个引号之间不需要括号。在此用例中,将 variable 与 ampersands 连接起来并且不将其括在引号中使其成为 variable不是 文字 。 (您会在下图中看到 可变代码突出显示 。)
在 Automator 工作流程中:
在下图中,注意两个 操作 上的 Options 设置,其中
[√] 忽略此操作 input 已选中。这会在它与之前的 action 之间创建断开连接,从而忽略其 input
。查看亮点,与下面的 action 之间相比,它不再连接。
勾选了[√] Ignore this actions input的actions不应该直接传递任何信息到下一个action,因为它们应该独立于此用例中的后续 action。
屏幕截图显示了我是如何尝试执行此操作的。我似乎无法将捕获的变量传递给 applescript。我是 applescript 的新手,所以很可能是一些非常基本的东西让我感到困惑。
基本语法之类的。目前传递的是文本'(input02)',而不是变量。
用谷歌搜索,没有运气。有什么想法吗?
我发现 Automator workflow 和 AppleScript [= OP 中的 33=]代码。
在AppleScript代码中:
在第二个 运行 AppleScript action 中,OP 中包含的图像中,代码应该如下:
on run {input, parameters}
set input02 to (input as text)
delay 2
tell application "Google Chrome"
execute front window's active tab javascript ¬
"document.getElementById('title').value = '" & input02 & "';"
execute front window's active tab javascript ¬
"document.getElementById('wmd-input').value = 'body copy goes here';"
end tell
end run
- 在第一个
execute
行中,'(inputs02)'
被改成'" & input02 & "'
,从而让它实际上通过了[=33=input02
变量的]值。正如最初编码的那样,它传递的是文字input02
而不是input02
变量 的 值 因为它被捕获了两个引号之间不需要括号。在此用例中,将 variable 与 ampersands 连接起来并且不将其括在引号中使其成为 variable不是 文字 。 (您会在下图中看到 可变代码突出显示 。)
在 Automator 工作流程中:
在下图中,注意两个 操作 上的 Options 设置,其中
[√] 忽略此操作 input 已选中。这会在它与之前的 action 之间创建断开连接,从而忽略其 input
。查看亮点,与下面的 action 之间相比,它不再连接。
勾选了[√] Ignore this actions input的actions不应该直接传递任何信息到下一个action,因为它们应该独立于此用例中的后续 action。