Reputation: 107
The screenshot shows how I'm trying to do this. I can't seem to pass a captured variable onto applescript. I'm new to applescript, so it's likely something very basic that's tripping me up.
Basic syntax or something like that. At present, the text '(input02)' is being passed, rather than the variable.
Have googled, no luck. Any ideas?
Upvotes: 1
Views: 1236
Reputation: 7555
I see a few things wrong with the Automator workflow and the AppleScript code in the OP.
In the AppleScript code:
In the second Run AppleScript action, of the image included in the OP, the code should be as follows:
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
line, '(inputs02)'
is changed to '" & input02 & "'
, thus allowing it to actually pass the value of the input02
variable. As was originally coded, it was passing a literal input02
not the value of the input02
variable because it was captured between two quotes and the parentheses are not necessary. In this use case, concatenating the variable with ampersands and not enclosing it in quotes makes it a variable not a literal. (You'll see the variable code highlighting in the image below.)In the Automator workflow:
In the image below, note the Options settings on two of the actions where the
[√] Ignore this actions input is checked. This creates a disconnect between it and the previous action, thus ignoring its input
. See the highlights, where compared to between the action below, it's no longer connected.
The actions which have the [√] Ignore this actions input checked should not be directly passing any information to the next action, as they are supposed to be independent of the subsequent action in this use case.
Upvotes: 2