Reputation: 19
I am writing a bash script that utilizes AppleScript that disables the microphone and camera, and then clicks the "Join now" button on the google meet webpage. The portion that disables the microphone and camera works perfectly, but I am running into issues with the part of the script that is meant to click the join button. Here is the script:
#!/bin/bash
osascript <<EOF
tell application "System Events"
delay 4
key code 14 using command down
delay 1
key code 2 using command down
delay 1
end tell
EOF
#the following is not working-
osascript <<EOF
tell application "brave"
tell active tab of window 1 to -
execute JavaScript "document.getElementById('Join now')[0].click();"
end tell
EOF
When the second part of the script tries to execute, I get this error:
62:63: syntax error: Expected expression but found end of line. (-2741)
How do I fix this error and get the script to execute properly (click the button)?
Upvotes: 1
Views: 2057
Reputation: 7555
You do not have a proper line continuation character after to
:
tell active tab of window 1 to -
Use: ¬
, e.g.:
tell active tab of window 1 to ¬
The line continuation character can be created by typing optionL in Script Editor.
If it still throws an error, then put it all on one line, e.g.:
tell active tab of window 1 to execute JavaScript "document.getElementById('Join now')[0].click();"
Upvotes: 2