|
|
|
02-18-2018, 07:51 PM
|
#1
|
Human being with feelings
Join Date: Jan 2017
Posts: 113
|
HTTP Requests from ReaScript
Is it possible to access the internet and do HTTP PUT requests via Lua or EEL or some other way?
I am trying to control Hue lights from within Reaper and I have a solution working but it shows a popup of the Windows command window each time and is distracting. I would like to find a way to prevent that.
Currently there is a Lua script that calls one of two javascripts that change the light color based on the recording status.
What I would like is to eliminate the external javascript files and do this all from ReaScript with no popup windows. Is that possible? Thanks!!
Here are the files I'm using currently:
http://files.civilaudio.com/b/NMtI4CBqcvSnrg0X2VEr
|
|
|
02-18-2018, 11:44 PM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Heda VIP dowbload is able to download things without opening CMD.
Cfillion did create ShellExecute reascript function which will allows on windows to not open the cmd windows with CLI commands. It is waiting to be metge in next SWS release.
Also, maybe check cURL. I think it is possible to call that for http post request from reascript (I dont know how to use it though).
|
|
|
02-19-2018, 05:43 AM
|
#3
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
cURL + reaper.ExecProcess should work without briefly flashing the command prompt.
Code:
curl -X PUT -d '{"on":false,"bri":1,"sat":255,"hue":0}' http://192.168.1.102/api/USERID/lights/1/state
Quote:
Originally Posted by X-Raym
Cfillion did create ShellExecute reascript function which will allows on windows to not open the cmd windows with CLI commands. It is waiting to be metge in next SWS release.
|
ShellExecute isn't for running arbitrary commands: it takes a file or URL and opens it in the default application. It's a better alternative to the "start" command. It's pretty much the same as the existing BR_Win32_ShellExecute without the unneeded arguments + returning the same values on every OS.
Last edited by cfillion; 02-19-2018 at 05:59 AM.
|
|
|
02-19-2018, 11:11 AM
|
#4
|
Human being with feelings
Join Date: Jan 2017
Posts: 113
|
Quote:
Originally Posted by Veto
(Answering here instead of the original thread) using reaper.ExecProcess what about this?
|
This works!!
Thank you.
For reference, here is the working solution:
http://files.civilaudio.com/b/NMtI4CBqcvSnrg0X2VEr
|
|
|
02-19-2018, 11:27 AM
|
#5
|
Human being with feelings
Join Date: Jan 2017
Posts: 113
|
Quote:
Originally Posted by Veto
Great!
btw others to load the script into Reaper would need to remove the ".txt" extension from the lua file.
(at least I'm not able to import a .txt here)
|
Yes, I only had the .txt there so it was viewable in the browser without downloading. Switched it to the .lua version now. Thanks again to everyone for your help!
|
|
|
02-19-2018, 12:05 PM
|
#6
|
Human being with feelings
Join Date: Jan 2017
Posts: 113
|
I added a new post for clarity that details all of the instructions on how to get this setup. Let me know or post in that thread if you'd like to comment/clarify anything. Thanks again for everyone's help!
https://forum.cockos.com/showthread.php?p=1956540
|
|
|
03-17-2020, 12:00 PM
|
#7
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by cfillion
cURL + reaper.ExecProcess should work without briefly flashing the command prompt.
Code:
curl -X PUT -d '{"on":false,"bri":1,"sat":255,"hue":0}' http://192.168.1.102/api/USERID/lights/1/state
|
But reaper.ExecProcess doesn't seem to work at all on the Mac, or am I missing something?
|
|
|
03-17-2020, 12:07 PM
|
#8
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
IMHO Curl should be in some extension-plugin.
Working with command-line-tools is sometimes really slow, as every time you run a command, it will open a new instance of the command-line.
This is ok for few files or requests but the more it becomes, the worse it gets, probably.
Making this perform sufficiently is probably a heavy task.
Have no idea though, how to do it practically, especially the receive part, as send/receive is probably very asynchronous in regards of http/web-requests.
|
|
|
03-17-2020, 12:08 PM
|
#9
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Quote:
Originally Posted by cohler
But reaper.ExecProcess doesn't seem to work at all on the Mac, or am I missing something?
|
It requires an absolute path to the executable on macOS and Linux.
|
|
|
03-22-2020, 09:41 AM
|
#10
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by cfillion
It requires an absolute path to the executable on macOS and Linux.
|
Thanks!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:26 AM.
|