Tips and Tricks


Using Chrome Fallback

If you can’t get your Android phone to connect to EventGhost you can try Chrome fallback:

  • Have both Chrome and EventGhost running on your PC
  • Install the AutoRemote Chrome Extension
  • Make sure you have Chrome on your Android device list by pressing the “Register Chrome on Devices” button in the Chrome Extension options
  • Now send a message to EventGhost again. If it doesn’t succeed it will be sent to the Chrome Extension which will in turn redirect it to EventGhost

This allows your EventGhost to be always accessible no matter where you are.

Send messages from EventGhost to your phone directly via Wifi and not through the web

To communicate directly do this:

  • when you connect to your wifi network on your phone enable the AutoRemote wifi service with the “AutoRemote Wifi” action in Tasker
  • use the “AutoRemote Devices” Tasker action to send your information to EventGhost so it has your phone’s latest IP
  • in EventGhost go to the AutoRemote plugin settings, choose your phone at the bottom and make sure that “Try to contact via local ip” is enabled

EventGhost should now send messages directly :)

 

Opening files on your phone from the Windows Explorer context menu:

  • Copy this text, in EventGhost select “Configuration Tree” and paste the text:
  • <?xml version="1.0" encoding="UTF-8" ?>
    <EventGhost Version="1630">
    <Macro Name="AutoRemote: Sending files to your android device" Expanded="True">
    <Event Name="Main.SentFromExplorer.File" />
    <Action>
    AutoRemote.SendMessage(u'Android Device', u'', u'', u'files', u'', u'', u'', '', u'{eg.event.payload[0]}')
    </Action>
    </Macro>
    </EventGhost>
  • A new EventGhost Macro will be created
  • In that macro enter the AutoRemote action and select your Android device there.
  • Make sure your device has the AutoRemote Wifi Service turned on and is reachable by EventGhost (try to send a message to it through wifi and see if it works). Also make sure that the device has the option  “Try to contact via local IP if available” enabled in the main AutoRemote configuration in EventGhost.
  • When you enable the AutoRemote Wifi service on your phone, also use the “AutoRemote Devices” action to send your info to EG, to make sure it has your device’s latest IP address
  • After doing the above step, check that EG received your device info in the log on the left
  • Right-click any file in Windows Explorer and select “Send to EventGhost”
  • On your device, you will receive a message with the text “files”. That message has a variable %arfiles() which is an array
  • Use %arfiles(1) (first file, in this case it’s the only one) whichever way you like. You can open it directly with the “Open File” action in Tasker. If you want to open it with a specific app you can use the AutoShare “Open File” action found here: http://joaoapps.com/autoshare/intents/

Generating an event in EventGhost from the command line

Execute a command similar to this:
"C:\Program Files (x86)\EventGhost\EventGhost.exe" -event CoolEvent payload1 payload2 payload3

and replace the relevant parts.

 

Copying some text from your phone to the Windows clipboard

  • On your phone send “copy=:=%CLIP” to EventGhost to send the current clipboard or “copy=:=ANY TEXT HERE” to send any text
  • Copy this text, in EventGhost select “Configuration Tree” and paste the text:
  • <?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

Copying your PC’s clipboard to your phone with a keyboard shortcut.

  •  Add the “Keyboard” plugin in EventGhost
  • Select your “Configuration Tree” item on the right in EventGhost and past the following text there:
  • <?xml version="1.0" encoding="UTF-8" ?>
    <EventGhost Version="1630">
    <Macro Name="Send clipboard to my device" Expanded="True">
    <Event Name="Keyboard.Ctrl+Alt+V" />
    <Action>
    AutoRemote.SendMessage(u'My Device', u'URL', u'device', u'copy=:={eg.WinApi.Clipboard.GetClipboardText()}', u'', u'', u'', '', u'')
    </Action>
    </Macro>
    </EventGhost>
  • Enter the newly created AutoRemote action and set your device
  • Now whenever you press Ctrl+Alt+V on your PC, the PC’s clipboard will be sent to your device with the copy command
  • Check here to see how to react to the copy command:

Opening a received file in EventGhost

  • Setup a macro with the event AutoRemote.Message.Open
  • In the Macro, add a “Python Command” action. Write the following command:
  • from os import startfile;startfile(eg.event.payload.files[0])
  • Send a message to EventGhost with the text “Open” and in the files field select any file.
  • The message and file should be sent to EventGhost and opened on your PC automatically.

 

Send messages to EventGhost directly via URL

  • Access http://localhost:1818/?message=MESSAGE_HERE from your own PC to send a message to your local EventGhost. If you’re on  another PC, you can replace localhost with your IP address.

Send PC Battery Level to phone

paste this in your EG tree:


<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1630">
<Macro Name="Send Battery Level" Expanded="True">
<Event Name="AutoRemote.Message.pcbatt" />
<Action>
EventGhost.PythonScript(u'from ctypes import windll, byref, Structure, c_ubyte, c_ulong\n\nclass SYSTEM_POWER_STATUS(Structure):\n    _fields_ = [("ACLineStatus", c_ubyte),\n                ("BatteryFlag", c_ubyte),\n                ("BatteryLifePercent", c_ubyte),\n                ("Reserved1", c_ubyte),\n                ("BatteryLifeTime", c_ulong),\n                ("BatteryFullLifeTime", c_ulong)]\n\nsps = SYSTEM_POWER_STATUS()\nwindll.kernel32.GetSystemPowerStatus(byref(sps))\neg.result = sps.BatteryLifePercent')
</Action>
<Action>
AutoRemote.SendMessage(u'My device', '', u'dddd', u'pcbatt=:={eg.result}', u'', u'', u'', '', u'', u'')
</Action>
</Macro>
</EventGhost>

You need to set your own recepient in the AutoRemote message action.

This will make your PC send its battery level whenever it receives an AutoRemote message like “pcbatt”. Of course you can change the trigger to anything you like.

 

Send some text to your phone from an input dialog on your PC

Paste these 2 bits in your EG tree:

  • <?xml version="1.0" encoding="UTF-8" ?>
    <EventGhost Version="1688">
    <Macro Name="AutoRemote: Show input dialog: Input some text" Expanded="True">
    <Event Name="Keyboard.Ctrl+Alt+C" />
    <Action>
    AutoRemote.ShowInputDialog(u'Copy Text to Phone', u'Text to copy', u'', u'copy', False)
    </Action>
    </Macro>
    </EventGhost>
  • <?xml version="1.0" encoding="UTF-8" ?>
    <EventGhost Version="1688">
    <Macro Name="Remote Copy after dialog" Expanded="True">
    <Event Name="Main.Input.OK.copy" />
    <Action>
    AutoRemote.SendMessage(u'Your device', u'', u'', u'paste=:={eg.event.payload}', u'', u'', u'', '', u'', u'')
    </Action>
    </Macro>
    </EventGhost>

You need to set your own recepient in the AutoRemote message action.

This will make

  • an input dialog show up when you press Ctrl+Alt+C
  • After you write something in the dialog, the Main.Input.OK.copy event will be triggered in EG
  • The other macro will react to that and send the text with the “paste=:=” prefix to your phone.
  • You can change “paste=:=” to whatever you want to do any other command on your phone