Hello,
I have been using EventGhost 0.3.7.r1462 with Windows 7 for about 3 weeks now, and I love it. Everything works quite fine. There is only one thing which I haven't managed to do yet. I'm not sure if it is possible, but I'd like to use a button on my X10 remote to change the standard sound device of my audio output in Windows. This can be done by entering a series of keys: in my case something like "Win-Key + sound + Enter + Cursor Down + Cursor Down + Cursor Down + Tab + Tab + Cursor Down + Enter + Enter". These sequence would have to be typed in one after another in order to work, so I can't use the keyboard emulator with the "+" operator I think.
Is there any possibility to create a macro with multiple sequential keyboard inputs or could this be done by a python script maybe? If so, how?
Thanks in advance.
Christian
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.
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.
Create a macro with multiple sequential keyboard inputs
-
jesseblue82
- Posts: 3
- Joined: Tue Sep 07, 2010 2:09 pm
Re: Create a macro with multiple sequential keyboard inputs
Type something like this in the keyboard emulator (I'm not sure about the sound key) and it will send them in sequence.
Edit: added sound. And I'm wondering if there isn't a more direct way to change the sound, maybe I'll check in Windows 7 later(I'm using WinXP right now)
jonib
Code: Select all
{Win}sound{Enter}{Down}{Down}{Down}{Tabulator}{Tabulator}{Down}{Enter}{Enter}jonib
Last edited by jonib on Wed Sep 08, 2010 10:46 am, edited 1 time in total.
-
jesseblue82
- Posts: 3
- Joined: Tue Sep 07, 2010 2:09 pm
Re: Create a macro with multiple sequential keyboard inputs
Thanks, I'll try that out when I come today. The input is supposed to be "Win-Key - s - o - u - n - d - Enter - ... " (i.e. I enter "sound" in the search field of Windows). So I guess your hint could do the job. I will let you know if it works.
Christian
Christian
Re: Create a macro with multiple sequential keyboard inputs
You can open the control panel sound dialog more easily by running "control mmsys.cpl sounds".
I had a quick look and I didn't find an easy/reliable API for changing the sound device. I did run into some third party tools that might be useful though. (Vista Audio Changer, Quick Sound Switch, STADS and Coastal Audio Changer..)
If you can find a good way to change the audio device please let us know.. maybe it could be made into an EG plugin.
I had a quick look and I didn't find an easy/reliable API for changing the sound device. I did run into some third party tools that might be useful though. (Vista Audio Changer, Quick Sound Switch, STADS and Coastal Audio Changer..)
If you can find a good way to change the audio device please let us know.. maybe it could be made into an EG plugin.
-
jesseblue82
- Posts: 3
- Joined: Tue Sep 07, 2010 2:09 pm
Re: Create a macro with multiple sequential keyboard inputs
Hello,
thank you all for your help again. It took me some time to post this, but this is my current solution for the problem: I created a macro which
1. Opens "control mmsys.cpl sounds"
2. Pauses for about 1 second
3. Uses some keyboard emulations ( {Down}{Down}{Down}{Tab}{Tab}{Down}{Down}{Return}{Return} )
I assigned this to a remote button which now switches from my Laptop speaker boxes to the HDMI audio output. Unfortunately, to switch back I had to create another macro with different keyboard emulations. That's why I also tried the Vista Audio Changer tool which didn't work for me at all. It seemed very buggy and it had some display problems (probably doesn't really support Windows 7). This two macro solution works quite good. If anyone finds something better, please le me know.
thank you all for your help again. It took me some time to post this, but this is my current solution for the problem: I created a macro which
1. Opens "control mmsys.cpl sounds"
2. Pauses for about 1 second
3. Uses some keyboard emulations ( {Down}{Down}{Down}{Tab}{Tab}{Down}{Down}{Return}{Return} )
I assigned this to a remote button which now switches from my Laptop speaker boxes to the HDMI audio output. Unfortunately, to switch back I had to create another macro with different keyboard emulations. That's why I also tried the Vista Audio Changer tool which didn't work for me at all. It seemed very buggy and it had some display problems (probably doesn't really support Windows 7). This two macro solution works quite good. If anyone finds something better, please le me know.
-
seth.feinberg
- Posts: 25
- Joined: Mon May 09, 2011 11:29 pm
Re: Create a macro with multiple sequential keyboard inputs
First off, thanks to both of you for the amazing post. This is without a doubt the most pertinent and succinct forum thread I've ever stumbled across. I wanted to know how to switch my sound output from HDMI to Analog (since my receiver's Zone 2 requires an analog input, but I like 5.1 surround sound on most occasions) and back again and this post was everything I needed. In case you're curious, just like the jesseblue82 I had to make 2 macros. One to "Enable HDMI":
...and one to "Enable Analog":
They work exactly as I want/need them to (pretty exciting for my first macro)! I assigned them the "hotkeys" of ctrl+alt+1 and ctrl+alt+2 respectively and plan to add them to my Logitech remote for their respective Activities. My only concern is false executions. What I mean by that is, for instance, executing the "Enable HDMI" EventGhost Macro when I'm already on HDMI or when the Sound window is already up. I'm sure this is a standard macro coding problem, but I feel like I need some kind of "if" statment or better yet the ability to "check the state" or something. Obviously I'm not down with the lingo:), but I hope I'm communicating my question adequately. Bascially these EventGhost's work perfect when executed under perfect circumstances, but I'm worried if they are executed under the wrong circumstances, these simple keyboard strokes could screw some stuff up. Do any of ya'll have any suggestions to idiot proof these EventGhosts?
And am I right to "noun" AND pluralize EventGhost?:)
P.S. oh nuts, just realized how old this last post was. Well this thread is too perfect for what I need not to give it a shot, sorry for bumping this thread up...
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1494">
<Macro Name="Enable HDMI" Expanded="True">
<Event Name="Keyboard.LCtrl+LAlt+1" />
<Event Name="Keyboard.RCtrl+RAlt+1" />
<Action>
System.Execute(u'rundll32.exe', u'shell32.dll,Control_RunDLL mmsys.cpl,,0', 0, False, 2, u'')
</Action>
<Action>
EventGhost.ShowOSD(u'HDMI', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 4.0, True)
</Action>
<Action>
EventGhost.Wait(0.10000000000000001)
</Action>
<Action>
Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 8.0, 0)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
EventGhost.Wait(0.10000000000000001)
</Action>
<Action>
Window.SendKeys(u'{Tabulator}{Tabulator}{Enter}', False)
</Action>
<Action>
EventGhost.Wait(0.10000000000000001)
</Action>
<Action>
Window.SendKeys(u'{Escape}', False)
</Action>
</Macro>
</EventGhost>Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1494">
<Macro Name="Enable Analog" Expanded="True">
<Event Name="Keyboard.LCtrl+LAlt+2" />
<Event Name="Keyboard.RCtrl+RAlt+2" />
<Action>
System.Execute(u'rundll32.exe', u'shell32.dll,Control_RunDLL mmsys.cpl,,0', 0, False, 2, u'')
</Action>
<Action>
EventGhost.ShowOSD(u'Analog', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 4.0, True)
</Action>
<Action>
EventGhost.Wait(0.10000000000000001)
</Action>
<Action>
Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 8.0, 0)
</Action>
<Action>
Window.SendKeys(u'{Down}{Down}', False)
</Action>
<Action>
EventGhost.Wait(0.10000000000000001)
</Action>
<Action>
Window.SendKeys(u'{Tabulator}{Tabulator}{Enter}', False)
</Action>
<Action>
EventGhost.Wait(0.10000000000000001)
</Action>
<Action>
Window.SendKeys(u'{Escape}', False)
</Action>
</Macro>
</EventGhost>And am I right to "noun" AND pluralize EventGhost?:)
P.S. oh nuts, just realized how old this last post was. Well this thread is too perfect for what I need not to give it a shot, sorry for bumping this thread up...
