Http Curl Command Script

203 views
Skip to first unread message

Projectile Objects

unread,
Sep 15, 2022, 10:45:50 AM9/15/22
to QLab
I'm bouncing into errors, compiling a simple script.

If I open terminal and run:

The relay I'm controlling turns on.

When I run a script in Qlab:

tell application "Terminal" to activate

tell application "Terminal"

   do script curl "http://192.168.8.185/relay/0?turn=off"

end tell


It doesn't work, if I run:

tell application "Terminal" to activate

tell application "Terminal"

   do script "curl" & "http://192.168.8.185/relay/0?turn=on"

end tell


Then the terminal opens and runs: curlhttp://192.168.8.185/relay/0?turn=on

The problem is I need the double quotes to "..."  to run the http command in terminal, but when I add the quotes to this script I can't compile it.


For example, something like this won't compile:

tell application "Terminal" to activate

tell application "Terminal"

   do script "curl "http://192.168.8.185/relay/0?turn=on"" in window 1

   do script "EXIT" in window 1

   delay 0.2

   tell application "Terminal" to quit

end tell


Appreciate the help.  Thanks

Projectile Objects

unread,
Sep 15, 2022, 2:47:43 PM9/15/22
to QLab
Additionally, Iif I use:

tell application "Terminal" to activate
tell application "Terminal"
    do script "curl http://192.168.8.185/relay/0?turn=on"
end tell

Then it enters curl http://192.168.8.185/relay/0?turn=on into the terminal and does not properly trigger the relay.

Joe Wilson

unread,
Sep 15, 2022, 3:35:36 PM9/15/22
to ql...@googlegroups.com
You need to escape your quotes that you want sent to terminal.

Try




--
Contact support anytime: sup...@figure53.com
Follow QLab on Twitter: https://twitter.com/QLabApp
User Group Code of Conduct: https://qlab.app/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/f4094187-c9d0-4406-915d-bcca538393adn%40googlegroups.com.


--
_________________________
Joe Wilson, ATD/Sound
Indian River State College

Adding one more "me too" to the
collective internet consciousness.

Projectile Objects

unread,
Sep 16, 2022, 9:52:28 AM9/16/22
to QLab
Works perfect!  Thank you.

Ian Morley

unread,
Sep 18, 2022, 2:47:17 PM9/18/22
to QLab
Unsolicited advice: you don't need to use terminal to run a CURL. just do shell script "[your CURL]".

I've been using this in my workflow for a few months, and it's been great.

Reply all
Reply to author
Forward
0 new messages