Page 1 of 1

entering a payload into Windows Command

Posted: Thu Nov 05, 2015 10:11 pm
by bryanleesterk
First off thanks for any help and sorry for the I'm sure will be a noob question. I'm just in the process of starting to learn Python with no previous programming experience

First off I use TerRemote for Android and I'm trying to set up a seekbar to adjust the brightness on my laptop. I have the TerRemote part no problem but it's the Eventghost side that has me stumped. TerRemote sends the event "TCP.brightness ['192.168.0.30', u'70.0']" where of course the u'70.0 is the "brightness" payload.

As far as I have found "nircmd" is the best way to go about changing the screen brightness with a simple command of "nircmd setbrightness 70" and it works flawless. 70 of course can be replaced with any integer between 0 and 100.

What I can't figure out is how to take the u'70.0 payload and place it into the nircmd command.

Any help with an explanation would be much appreciated!!!

Re: entering a payload into Windows Command

Posted: Fri Nov 06, 2015 5:16 am
by eirik226
Hello,

I'm not sure if this will help you in anyway, but I use a slider on a webpage to control my lights (dim level) and I use this python script to do so:

Code: Select all

suffix = eg.event.suffix;
eg.globals.example='hejsan hoppsan';
try :
    volume = int(suffix[suffix.find(".")+1:]);
except Exception:
    volume = 0;
else:
    eg.plugins.System.SetMasterVolume(volume, 0)
    eg.globals.masterVolumeStr = str(volume);
And the event that triggers it is like this:

Code: Select all

<Event Name="HTTP.volSlider.*" />
As you can see the " * " is what my dim level is - so * can be 70 etc.

As I said, not sure if this helps you in anyway, but all I can give you! I guess you might need to talk to someone a bit more python experienced.

Re: entering a payload into Windows Command

Posted: Fri Nov 06, 2015 4:42 pm
by bryanleesterk
Thanks for the try. I actually figured out another way to do it which is much easier with not much python background. In TerRemote instead of using ${value} as the payload in the action on click I entered the ${value} at the end of the event so TerRemote sends the value as part of the string. I have set up 10 macros in EG to coincide with the 10 brightness steps in TerRemote. If anyone has the correct way to do it with Python, I would still love to know.