Scripting systemcommand argument passed badly

Ask a question about the usage of QLC+ with the Linux operating system
Post Reply
iamchrislaurie
Posts: 58
Joined: Mon Apr 27, 2015 11:27 am
Real Name: Chris Laurie

The following command works from the command line (using Linux):

audtool set-volume $(('audtool get-volume' - 5))

I cannot get that to script. I have tried many variants of the following

systemcommand:audtool arg1:"set-volume" arg2:"$(('audtool get-volume' - 5))"

Is there some syntax trick to getting the exact line passed to the OS?
janosvitok
Posts: 1266
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

Maybe you need to call bash to do the parameter expansion.

systemcommand:bash arg1: "audtool" arg2:"set-volume" arg3:"$(('audtool get-volume' - 5))"
iamchrislaurie
Posts: 58
Joined: Mon Apr 27, 2015 11:27 am
Real Name: Chris Laurie

Thank you for the response Jano!

Unfortunately that did not work.
User avatar
sbenejam
Posts: 540
Joined: Sun Apr 12, 2015 6:28 pm
Real Name: Santiago Benejam Torres
Contact:

This is a command that calls a python test script that I use: systemcommand:python-script.py arg:dspdfviewer arg:P
Maybe it could help.
plugz
Posts: 637
Joined: Sun Apr 12, 2015 6:30 pm
Real Name: David

Try this one:

Code: Select all

systemcommand:bash arg1:"-c" arg2:"audtool set-volume $(($(audtool get-volume) - 5))"
User avatar
mcallegari
Posts: 4462
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

I have written an example in the documentation, so where did you guys read arg1, arg2, etc ?

http://www.qlcplus.org/docs/scripteditor.html

Code: Select all

systemcommand:/usr/bin/vlc arg:-f arg:/home/user/video.mp4 // plays my video with VLC in fullscreen
most likely this is what you want

Code: Select all

systemcommand:audtool arg:set-volume arg:"$(('audtool get-volume' - 5))"
By the way, this looks more like a usage question rather than a issue report...
plugz
Posts: 637
Joined: Sun Apr 12, 2015 6:30 pm
Real Name: David

mcallegari wrote:I have written an example in the documentation, so where did you guys read arg1, arg2, etc ?
You're right, arg1 arg2 etc is useless.

But it works. You can also replace "arg" with "hi" or "hello", it will work too. Should a github issue be opened for this ?

Code: Select all

systemcommand:audtool arg:set-volume arg:"$(('audtool get-volume' - 5))"
This does not work, because

Code: Select all

$((`audtool get-volume`))
is something that has to be interpreted by bash. QLC+ does not run processes through bash commands. Also, I think the simple quote around

Code: Select all

audtool get-volume
are a miscopy, they should be backquotes. But this is another issue.
By the way, this looks more like a usage question rather than a issue report...
Maybe.



Please try this one:

Code: Select all

systemcommand:bash arg:-c arg:"audtool set-volume $(($(audtool get-volume) - 5))"
User avatar
mcallegari
Posts: 4462
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

But it works. You can also replace "arg" with "hi" or "hello", it will work too. Should a github issue be opened for this ?
Ugh...yes please

Then have a look at #843 please :)
This does not work, because

Code: Select all

$((`audtool get-volume`))
is something that has to be interpreted by bash. QLC+ does not run processes through bash commands. Also, I think the simple quote around
Right. I'm wondering if the QProcess class can actually work like a proper shell. I'll check the docs when I have some time
plugz
Posts: 637
Joined: Sun Apr 12, 2015 6:30 pm
Real Name: David

mcallegari wrote: Right. I'm wondering if the QProcess class can actually work like a proper shell. I'll check the docs when I have some time
No it can't. It's not a shell command interpreter. It simply runs a process.
And I think it's fine like this. Users can still use "bash -c" to run shell commands. Or even write the script in an external .sh file.
User avatar
mcallegari
Posts: 4462
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

plugz wrote:
mcallegari wrote: Right. I'm wondering if the QProcess class can actually work like a proper shell. I'll check the docs when I have some time
No it can't. It's not a shell command interpreter. It simply runs a process.
And I think it's fine like this. Users can still use "bash -c" to run shell commands. Or even write the script in an external .sh file.
Actually, you can pass the system environment to it:
http://doc.qt.io/qt-5/qprocess.html#set ... nvironment

In any case I agree regarding a shell script.
I would do something like

Code: Select all

setVolume.sh 5
setVolume.sh -5
iamchrislaurie
Posts: 58
Joined: Mon Apr 27, 2015 11:27 am
Real Name: Chris Laurie

That is what I did in the end I created a shell file. I could not get the bash -c to work. This solution probably won't work in Windows.

One thing that would work for this use case is if the scripting allowed for the interim storage of the result of a systemcommand call - some like this

%v = systemcommand:audtool arg1:get-volume
systemcommand:audtool arg1:set-volume arg2:%v - 1

Not sure about how the syntax will work but that would give us the start of the capability to read and set dmx channel values via these variables.
Stringfamily
Posts: 11
Joined: Wed Feb 13, 2019 7:31 am
Real Name: JoelM

systemcommand:/bin/sh arg:/home/pi/PP-QLC-Lights/ShowVoxON.sh // copies show file with vocals to correct location


This is what in a few different versions I use to change audio files used in a show... works great. Attach it to a button and OSC command.
Post Reply