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.

How to pass eg.event.payload.arcomm from AutoRemote to cmd?

If you have a question or need help, this is the place to be.
Post Reply
akshay7394
Posts: 4
Joined: Mon Nov 14, 2016 5:04 pm

How to pass eg.event.payload.arcomm from AutoRemote to cmd?

Post by akshay7394 »

Hey everyone!

New to eventghost, still trying to get a grip on it all. Right now I'm trying to pass a variable received via AutoRemote onto a command line command which is being used to open a URL on a specific Chrome profile.

'eg.event.payload.arcomm' is the variable being handed off by AutoRemote. What could I be doing wrong? In the example below, if I replace "{eg.event.payload.arcomm}" with "facebook.com", it correctly loads facebook in the relevant chrome profile, but with the variable in there the command just doesn't run.

Any suggestions? Code attached below.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-beta4">
    <Macro Name="Run Chrome" Expanded="True">
        <Event Name="AutoRemote.Message.tester" />
        <Action>
            System.Command(u'"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" --args --profile-directory=Default -d {eg.event.payload.arcomm}', True, False, u'', True, False, False, False, False)
        </Action>
    </Macro>
</EventGhost>
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by eirik226 »

akshay7394 wrote:Hey everyone!

New to eventghost, still trying to get a grip on it all. Right now I'm trying to pass a variable received via AutoRemote onto a command line command which is being used to open a URL on a specific Chrome profile.

'eg.event.payload.arcomm' is the variable being handed off by AutoRemote. What could I be doing wrong? In the example below, if I replace "{eg.event.payload.arcomm}" with "facebook.com", it correctly loads facebook in the relevant chrome profile, but with the variable in there the command just doesn't run.

Any suggestions? Code attached below.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-beta4">
    <Macro Name="Run Chrome" Expanded="True">
        <Event Name="AutoRemote.Message.tester" />
        <Action>
            System.Command(u'"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" --args --profile-directory=Default -d {eg.event.payload.arcomm}', True, False, u'', True, False, False, False, False)
        </Action>
    </Macro>
</EventGhost>
So you are trying to send a URL from your mobile to the desktop? Or just a command that opens a specific website every time?

If it's the first one:

I know this is possible, but never done it myself. If you could write up a python script or command that prints that, you'll see what value it is. If the value is correct then you know there is nothing wrong on the mobile-side of things.

Code: Select all

print eg.event.payload.acromm
I am however sure I saw a guide on how to do this once, I'll link it if I find it.

EDIT: Take a look at this: https://joaoapps.com/autoremote/eventgh ... nd-tricks/, here you'll find all the info you need.

A quick fix that I see is to use this:
Copying some text from your phone to the Windows clipboard:

1. On your phone send ÔÇ£copy=:=%CLIPÔÇØ to EventGhost to send the current clipboard or ÔÇ£copy=:=ANY TEXT HEREÔÇØ to send any text
2. Copy this text, in EventGhost select ÔÇ£Configuration TreeÔÇØ and paste the text:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1630">
<Macro Name="Copy to Clipboard" Expanded="True">
<Event Name="AutoRemote.Message.copy" />
<Action>
EventGhost.PythonCommand(u'eg.WinApi.Clipboard.SetClipboardText(eg.event.payload.arcomm)')
</Action>
<Action>
EventGhost.ShowOSD(u'Copied to clipboard: "{eg.event.payload.arcomm}"', u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, False)
</Action>
</Macro>
</EventGhost>
Now when you receive the above mentioned message, the text will be copied to your clipboard and a message will appear on screen showing you what was copied
pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by pearbear »

Double click on the "Run Command" action.
Uncheck the box next to "Disable parsing of string".
Click "OK".
If the value of your variable is set correctly then it should now work as expected.
akshay7394
Posts: 4
Joined: Mon Nov 14, 2016 5:04 pm

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by akshay7394 »

Double click on the "Run Command" action.
Uncheck the box next to "Disable parsing of string".
Click "OK".
If the value of your variable is set correctly then it should now work as expected.
Aw man I love you, it's working perfectly now. Thanks a ton :D
akshay7394
Posts: 4
Joined: Mon Nov 14, 2016 5:04 pm

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by akshay7394 »

pearbear wrote:Double click on the "Run Command" action.
Uncheck the box next to "Disable parsing of string".
Click "OK".
If the value of your variable is set correctly then it should now work as expected.

Thank you! This worked perfectly. Follow-up question, does a command prompt not read "&" symbols? My URL is of the following structure:

Code: Select all

http://crm.simplotel.com/index.php?action=UnifiedSearch&module=Home&search_form=false&advanced=false&query_string=%searchdat
except the URL being passed on seems to be truncated down to just:

Code: Select all

http://crm.simplotel.com/index.php?action=UnifiedSearch
Am I doing something wrong? I tried placing the same link as a shortcut elsewhere and clicking on it opened the browser flawlessly, but through the command prompt it truncates.
pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by pearbear »

I'm not using AutoRemote but if I use the attached test tree that URL works fine for me so I don't think the issue is caused by the "Run Command" action but is lost somewhere else in your setup. Note how I've used the python command to print the value of the variable to the log. This can be a helpful technique for troubleshooting.

EDIT: Attachment removed at the request of kgschlosser:
viewtopic.php?f=12&t=9704
Last edited by pearbear on Mon Jun 05, 2017 1:51 pm, edited 1 time in total.
akshay7394
Posts: 4
Joined: Mon Nov 14, 2016 5:04 pm

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by akshay7394 »

pearbear wrote:I'm not using AutoRemote but if I use the attached test tree that URL works fine for me so I don't think the issue is caused by the "Run Command" action but is lost somewhere else in your setup. Note how I've used the python command to print the value of the variable to the log. This can be a helpful technique for troubleshooting.
I even tried copying the exact link from your XML to run the code through CMD and it still didn't work :(

These are the two commands I tried. Both open http://crm.simplotel.com/index.php?action=UnifiedSearch

Code: Select all

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --args --profile-directory=Default http://crm.simplotel.com/index.php?action=UnifiedSearch&module=Home&search_form=false&advanced=false&query_string=test+search

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --args --profile-directory=Default http://crm.simplotel.com/index.php?action=UnifiedSearch&module=Home&search_form=false&advanced=false&query_string=test+search
Am I doing something wrong? Missing something? It's literally just the opening-URL step that has me stuck, it's SO close. :(
pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: How to pass eg.event.payload.arcomm from AutoRemote to c

Post by pearbear »

I figured it out. That URLwas redirecting me to another URL with the ampersands, so I was having the same problem as you but I didn't notice.

The solution is to put quotation marks around the URL. Unfortunately I can only make that work if I remove the quotation marks from the command. That's a problem for the path to Chrome because there's a space in "Program Files (x86)"(what was Microsoft thinking when they named those folders?). So you need to use the Windows short path version, which should be C:\PROGRA~2\Google\Chrome\Application\chrome.exe. I've attached the updated tree file.
Attachments
URLtest.xml
(837 Bytes) Downloaded 189 times
Post Reply