Directory Watcher through LAN

Questions and comments specific to a particular plugin should go here.
Post Reply
User avatar
Geek2theBone
Posts: 5
Joined: Wed Sep 18, 2019 2:52 pm

Directory Watcher through LAN

Post by Geek2theBone » Wed Sep 18, 2019 3:24 pm

Background:

I use Voiceattack on my PC to control music playback (among a thousand other things). It simply uses the media hotkeys to pause/play when I say so.

Along with my PC, I use a Laptop and the software KVM switch Multiplicity so my keyboard/mouse can just be used on the laptop as if it were another monitor.

Also connecting these two machines is the awesome Voicemeeter with VLAN so my Laptop's line out is heard through my PC and the mic from my PC is used on the Laptop.

Issue

When I'm focusing/working on the laptop and want to voice command my music to play/pause it won't work due to the nature of the Voiceattack and Multiplicity connections.

I tried getting the Voiceattack profile on my laptop to control media through the Directory Watcher plugin which is running and configured on the PC. If I edit the directory/file through the PC directly in Notepad++ the Eventghost command works fine. It outputs the same media hotkey and music is controlled.

When I issue the voice command on the Laptop, however, the file gets updated through LAN and Eventghost shows this in the log identically as it appears when done directly on my PC... but the command does not fire.

The directory watcher is watching the local folder on the PC. I have others configured the same way where a voice command on PC > Laptop just fine.

dan Edens
Experienced User
Posts: 98
Joined: Mon Sep 24, 2018 7:57 pm

Re: Directory Watcher through LAN

Post by dan Edens » Tue Oct 01, 2019 8:16 pm

Geek2theBone wrote:
Wed Sep 18, 2019 3:24 pm
Background:

I use Voiceattack on my PC to control music playback (among a thousand other things). It simply uses the media hotkeys to pause/play when I say so.

Along with my PC, I use a Laptop and the software KVM switch Multiplicity so my keyboard/mouse can just be used on the laptop as if it were another monitor.

Also connecting these two machines is the awesome Voicemeeter with VLAN so my Laptop's line out is heard through my PC and the mic from my PC is used on the Laptop.

Issue

When I'm focusing/working on the laptop and want to voice command my music to play/pause it won't work due to the nature of the Voiceattack and Multiplicity connections.

I tried getting the Voiceattack profile on my laptop to control media through the Directory Watcher plugin which is running and configured on the PC. If I edit the directory/file through the PC directly in Notepad++ the Eventghost command works fine. It outputs the same media hotkey and music is controlled.

When I issue the voice command on the Laptop, however, the file gets updated through LAN and Eventghost shows this in the log identically as it appears when done directly on my PC... but the command does not fire.

The directory watcher is watching the local folder on the PC. I have others configured the same way where a voice command on PC > Laptop just fine.
You should try adding the "dump results to log" action seeing if there is something diffrent in the way it's giving the information.
than below that add a python script with this in it "print type(eg.event.payload)"

Let me know if those are identical and we can go from there.

User avatar
Geek2theBone
Posts: 5
Joined: Wed Sep 18, 2019 2:52 pm

Re: Directory Watcher through LAN

Post by Geek2theBone » Tue Oct 15, 2019 7:10 pm

I am seeing different "type" in the log. The event triggered by AutoRemote shows as 'instance' and the edit of the file seen by Directory Watcher is 'tuple'. I have no clue what that difference means.

10/15/2019 15:06:44 AutoRemote.Message.pause u'pause'
10/15/2019 15:06:44 Media Play/Pause
10/15/2019 15:06:44 Send Keystrokes: {Shift+Ctrl+Alt+Win+Multiply}
10/15/2019 15:06:45 Clear Pending Events
10/15/2019 15:06:45 Dump Result to Log
10/15/2019 15:06:45 None
10/15/2019 15:06:45 Python Script
10/15/2019 15:06:45 <type 'instance'>
10/15/2019 15:07:18 DirectoryWatcher.Updated (u'\\\\CENTRALDOGMA\\Play_Pause\\play_pause.txt',)
10/15/2019 15:07:18 Media Play/Pause
10/15/2019 15:07:18 Send Keystrokes: {Shift+Ctrl+Alt+Win+Multiply}
10/15/2019 15:07:18 Clear Pending Events
10/15/2019 15:07:18 Dump Result to Log
10/15/2019 15:07:18 None
10/15/2019 15:07:18 Python Script
10/15/2019 15:07:18 <type 'tuple'>

User avatar
Geek2theBone
Posts: 5
Joined: Wed Sep 18, 2019 2:52 pm

Re: Directory Watcher through LAN

Post by Geek2theBone » Mon Oct 21, 2019 6:03 pm

I did some more testing and it seems to be connected to mouse focus. If I'm focused on the EventGhost window or the Windows desktop I can use any program to edit the watched directory and the event fires, pausing/playing music through the Media keys.

However, if the focused program is Chrome or almost anything else the event is logged the same but the media key just seems to be ignored by the media player.

User avatar
kgschlosser
Site Admin
Posts: 5212
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Directory Watcher through LAN

Post by kgschlosser » Tue Oct 22, 2019 4:23 pm

ok you need to use the Find Window action before the send keys action. it sounds as tho you are not targeting th window where you want to keys to get sent to. and an application like chrome or any other application that supports media keys is going to consume the keystrokes. and not "pass them on" to other applications.

all you have to do is have your media player running. Open up the find window action use the cross hairs and select the media player. Move the action to directly before the Send Keys action that emulate the media shortcut keys. This should fix your issue because now you are explicitly sending the keys to only the media player.
If you like the work I have been doing then feel free to Image

User avatar
Geek2theBone
Posts: 5
Joined: Wed Sep 18, 2019 2:52 pm

Re: Directory Watcher through LAN

Post by Geek2theBone » Fri Oct 25, 2019 3:51 pm

I've used the "Find Window" option and find it actually reduces the times when it works.

E.g. When I disable "Find Window: Amazon Music.exe" I can at least click the Execute Item button in EG and get the macro to work. When it is active and targeting it stops working completely. With it disabled the macro works with some programs in focus, but not all.

Image

It makes sense that it SHOULD work with the player targeted, as right now it only works through the directory editor when my mouse focus is on desktop or other apps. If I'm focused on Chrome or Evernote the macro fires but Amazon Music seems to not receive the keystrokes.

User avatar
kgschlosser
Site Admin
Posts: 5212
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Directory Watcher through LAN

Post by kgschlosser » Sat Oct 26, 2019 2:18 am

I am pretty sure you are going to be SOL with this..

first off there is no API for the Amazon Music Application..

I downloaded and installed the application. the space bar will play pause the currently playing selection.. so no special media keys involved.
I enumerate a list of every single window that the application creates. this is quite a long list including all of the hidden stuff. I sent the pace keystroke to each of those windows trying both mechanisms available in windows that are used to emulate key presses. and it did not work.

Now if the folks over at amazon did some special hooking to check and see if a keystroke was coming from hardware or software and have it set up to ignore software input. It would not surprise me in the least. The reason I state this is because the question about the API has been brought up on more then a single occasion and Amazon's official response is no there is not one available and no we are not going to add one. This indicates that Amazon does not want to have any other application being able to control it's player.. And to uphold that they would design the application to ignore software keyboard emulation.

The only way I have managed to get it to work is If i use the Find Window action taget Amazon Music.exe as the process. make sure you leave the search invisible unchecked. then after that action add the Bring to front action. then add a python command action and in that action type in

Code: Select all

del eg.lastFoundWindows[:]
Then add the wait action and set it for 0.5 seconds
and after the wait action add the send keys action.

here is a webpage with a few keyboard shortcuts listed for the app

https://shortcutworld.com/Amazon-Music- ... _Shortcuts

The only shitty thing about going this route is it is always going to bring the application to the front. I can write something that will grab the handle of the window that has focus and then return it to the top again after the script runs . But it seems that this is the only way to go about sending keystrokes to the damned thing.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5212
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Directory Watcher through LAN

Post by kgschlosser » Sat Oct 26, 2019 2:24 am

and the behavior you are describing is because the other applications are consuming the keystrokes because they are in focus. This is the same thing I have run into. It's the design of the Amazon player. It is not set up to listen for keystrokes sent directly to it. Unfortunately the only way is to bring the thing into focus and then send them. and the trick is that python command deleting any last found windows reported by the find window action. if this is empty then the send keys is going to just send to the message with no specific window in mind and whatever window is in focus is going to get the message.
If you like the work I have been doing then feel free to Image

User avatar
Geek2theBone
Posts: 5
Joined: Wed Sep 18, 2019 2:52 pm

Re: Directory Watcher through LAN

Post by Geek2theBone » Thu Nov 07, 2019 9:20 pm

Thanks for all the digging and follow up @kgschlosser !

The only thing weird for me is how I can reliably play/pause through VoiceAttack. It is just targeting the player App + Media Play_Pause. It doesn't bring the app to the front, however. Development on VA is pretty active so maybe I can find something there that will let me get two-system control over the player.

Thanks again!

User avatar
kgschlosser
Site Admin
Posts: 5212
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Directory Watcher through LAN

Post by kgschlosser » Fri Nov 08, 2019 7:31 am

idk maybe they are triggering the MCE remote somehow.. I will check them out also and ask some questions maybe get to a solution for ya.
If you like the work I have been doing then feel free to Image

Post Reply