Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Taking parameters from Autoremote messages.

If you have a question or need help, this is the place to be.
Post Reply
TaskerJack
Posts: 4
Joined: Fri Feb 21, 2014 2:02 pm

Taking parameters from Autoremote messages.

Post by TaskerJack »

Hi All

Been getting to grips with EG for a couple of days now and i've hit a bit of a stumbling block...

Basically what i'm trying to set up is a function of AVX for android whereby i ask it to find me information on something, this calls a tasker task that sends a message to EG via autoremote, (that message being "report %par1" (par1 is actually replaced by whatever i tell AVX to look for information on)) The message as it appears in EG log is as follows:

AutoRemote.Message.report params: [u'report', u'%par1']; command(s): ;

I've got the rest of the macro working fine, apart from pulling the parameter "u'%par1'" out of the message and converting it into whatever it needs to be to end up in the "text to type" field on an emulate keystrokes action. When i run the action from AVX it will send the correct message to EG, i.e. i ask it to look for information on Microsoft and EG will receive the message:
AutoRemote.Message.report params: [u'report', u'microsoft']; command(s): ;
But i don't know how to then get "microsoft" from here into the Text to type field to complete the function.

I'm not sure about variables or parameters in EG yet but i'm sure its something to do with that, does anybody have any ideas what i need to do?

EG version 0.4.1r1640
Windows 7 64bit SP1
Javier
Experienced User
Posts: 73
Joined: Sun Dec 01, 2013 3:45 pm

Re: Taking parameters from Autoremote messages.

Post by Javier »

Hi TaskerJack,

I do not completely understand your question but am assuming that you only want to fill the Action Emulate_Keystrokes->Text_to_type" field/box with the second payload value (in your example "%par1" as "report" is the first payload). If my above assumption is correct than all you need to do is type the following into the Text_to_type field/box

Code: Select all

{eg.event.payload[1]}
You can change the number "1" in the brackets to reflect the payload (i.e. 0=the first payload, 1=the second payload). If you are trying to trigger an Event with the payload use {eg.event.payload[1]} in the Trigger_event Action.

Hope This Helps,
Javier
TaskerJack
Posts: 4
Joined: Fri Feb 21, 2014 2:02 pm

Re: Taking parameters from Autoremote messages.

Post by TaskerJack »

Thanks for your reply, Javier...

That's exactly what i'm trying to do, yes. I've just tried your suggestion but i get the following error message when it attempts to emulate keystrokes action:

Code: Select all

20:26:59            Error in Action: "Emulate Keystrokes: {eg.event.payload[1]}"
20:26:59            Traceback (most recent call last) (1640):
20:26:59              File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
20:26:59                return self(*args)
20:26:59              File "C:\Program Files (x86)\EventGhost\plugins\Window\SendKeys.py", line 122, in __call__
20:26:59                eg.SendKeys(hwnd, data, useAlternateMethod)
20:26:59              File "C:\Program Files (x86)\EventGhost\eg\WinApi\SendKeys.py", line 430, in __call__
20:26:59                keyData = ParseText(keystrokeString)
20:26:59              File "C:\Program Files (x86)\EventGhost\eg\WinApi\SendKeys.py", line 367, in ParseText
20:26:59                res = unicode(eval(key, {}, eg.globals.__dict__))
20:26:59              File "<string>", line 1, in <module>
20:26:59            AttributeError: AutoRemotePayload instance has no attribute '__getitem__'
From what i can gather your suggestion should work, if i take out the [1] just leaving {eg.event.payload} then it types the entire string from the autoremote message like so:

params: [u'report', u'microsoft']; command(s): ;

Thats almost right! Does this mean there's an error somewhere else?
TaskerJack
Posts: 4
Joined: Fri Feb 21, 2014 2:02 pm

Re: Taking parameters from Autoremote messages.

Post by TaskerJack »

Re: Taking parameters from Autoremote messages.
Post by Javier ┬╗ Sat Feb 22, 2014 4:25 am

Hi TaskerJack,

I do not completely understand your question but am assuming that you only want to fill the Action Emulate_Keystrokes->Text_to_type" field/box with the second payload value (in your example "%par1" as "report" is the first payload). If my above assumption is correct than all you need to do is type the following into the Text_to_type field/box
CODE: SELECT ALL
{eg.event.payload[1]}

You can change the number "1" in the brackets to reflect the payload (i.e. 0=the first payload, 1=the second payload). If you are trying to trigger an Event with the payload use {eg.event.payload[1]} in the Trigger_event Action.

Hope This Helps,
Javier
Ok got it working pretty much, i needed to use {eg.event.payload.arpar[1]} to get the correct payload value in the text to type field. This now works perfectly with single word searches.

However, i've noticed that when i ask AVX to search for a multi-word subject i.e. Bill Gates, it autoremote sends the message as two separate values as below:

21:13:06 AutoRemote.Message.report params: [u'report', u'bill', u'gates']; command(s): ;

{eg.event.payload.arpar[1]} will only result in "bill" being searched for in this instance. I've tried {eg.event.payload.arpar[1]} {eg.event.payload.arpar[2]} which will do the trick but only if there are two parts to the search query.

Is there a way to get EG to use every part of the payload after 0, however many there may be?
Javier
Experienced User
Posts: 73
Joined: Sun Dec 01, 2013 3:45 pm

Re: Taking parameters from Autoremote messages.

Post by Javier »

TaskerJack wrote: Is there a way to get EG to use every part of the payload after 0, however many there may be?
There may be a way to do it but I do not know how. Maybe someone else could chime in.

What is written if you only place "{eg.event.payload.arpar}" in the text_to_type box? If the result is "report %par1" then you may be able to parse the payload.
Is the "report" part of "report %par1" sent from tasker? If it is maybe you could simply remove the "report" from "report %par1".

I use terRemote to send payloads to eventghost Emulate Keystrokes and it does not separate words into different payloads (Sorry, I know that is not much help).

You could also use a Tasker plugin called UDP Sender https://play.google.com/store/apps/deta ... .udpsender along with the Eventghost Broadcaster Plugin to send your data to eventghost. I have been using it to send events to eventghost from tasker and it works very well. I just tested the UDP Sender Plugin with the Emulate Keystrokes Action and I works, this would be very simple to setup and you would not have to use python scripts to parse the payload.

Tasker
Select a new task, select plugin, select UDP Sender, select edit:
Destination IP: ip address of computer running evenghost
Port: 33333
Text: Your_Event&&Your_Payload (i.e. report&&%par1)

Eventghost
Emulat Keystroke->
Text to type= {eg.event.payload[0]}

The above assumes you use the default settings in the Broadcaster Plugin
UDP port: 33333
Listening address: Ip address of your computer (unless you have more than one network card)
Respond to self broadcast= 'checked'
Payload delimiter="&&"
TaskerJack
Posts: 4
Joined: Fri Feb 21, 2014 2:02 pm

Re: Taking parameters from Autoremote messages.

Post by TaskerJack »

Thanks for the UDP tip, I've just replaced the AutoRemote function in the Tasker task with the UDP sender and it works perfectly now! So much simpler to use as well, think i'll stick to that from now on.

Just for the record, i tried {eg.event.payload.arpar} and the return i got in the "Text to type" field was somethign like "u'report u'bill u'gates"... i nearly gave up at that point!

Thanks again for your help, very much appreciated
Post Reply