Jump to content

Recommended Posts

Posted (edited)

I'm using EventGhost to control all my music and video playback on my HTPC. I'm running FxSound (DFX) which improves the audio quality for my various pc music apps. But I don't like to have it running when I switch to Plex to play a video, so I'd like EG to be able to close it. Unfortunately, there is no facility built into FxSound to allow for automating its functions, and it doesn't even appear as a running application in the task manager (only a process named dfx.exe).

I have tried using taskkill to kill the dfx.exe process tree, which works, but then I get NO sound from the pc at all because the default sound playback device is still "DFX Speakers". The only way to close FxSound properly is by right clicking it in the system tray, then exit. How can this operation be done from EG? Or is there a way to switch the default playback device to "Speakers"?

Edited by wysocki
Posted

I don't know what is EG. But from an AutoIt script, you can manipulate system tray quite easily using UIAutomation.  I have already done it for Network settings and it is working perfectly.  So I suppose you can program a similar approach with the applications you are using.

Posted

Some time ago i did a script to change default playback devices.

The exe has got all the icons and stuff like that, but if you dont trust, there's the script.

Keep in mind that some applications need to be restarted to assume the new default output.

See if this works for you and let us know.

SwitchSoundOutput.au3 SwitchSoundOutput.exe

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Found another option:

#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=Taskbar;controltype:=UIA_PaneControlTypeId;class:=Shell_TrayWnd") ;Taskbar
_UIA_setVar("oP2","Title:=;controltype:=UIA_PaneControlTypeId;class:=TrayNotifyWnd")    ;
_UIA_setVar("oP3","Title:=;controltype:=UIA_PaneControlTypeId;class:=SysPager") ;
_UIA_setVar("oP4","Title:=User Promoted Notification Area;controltype:=UIA_ToolBarControlTypeId;class:=ToolbarWindow32")    ;User Promoted Notification Area

_UIA_setVar("oUIElement","Title:=Speakers;controltype:=UIA_ButtonControlTypeId;class:=") ;ControlType:=UIA_ButtonControlTypeId;classname:=")

_UIA_Action("oP1","setfocus")
_UIA_Action("oP2","setfocus")
_UIA_Action("oP3","setfocus")
_UIA_Action("oP4","setfocus")

_UIA_action("oUIElement","highlight")
_UIA_action("oUIElement","click")

;=============================================================================

Send('{TAB}')
Sleep(100)
Send('{SPACE}')
Sleep(100)
Send('{UP}')
Sleep(100)
Send('{SPACE}')

Change Title:=Speakers accordingly, in my case it can switch between this and realtek.

 

CUIAutomation2.au3 UIAWrappers.au3

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

And how can we forget about image search?

Opt("MouseCoordMode", 1)
Local $x, $y
Local $MousePos = MouseGetPos()
ConsoleWrite('Mouse:'&$MousePos[0]&'x'& $MousePos[1]&@CRLF)
If _ImageSearch(@ScriptDir&'\Capture.PNG',1, $x, $y, 10, 0)=1 Then
    ConsoleWrite('Found in: '&$x&'x'&$y&@CRLF)
    MouseClick('Right', $x, $y)
    Sleep(100)
    MouseMove($MousePos[0], $MousePos[1])
EndIf
;===============================================================================
Func _ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $HBMP=0)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
EndFunc
;=============================================================================
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom, ByRef $x, ByRef $y, $tolerance,$HBMP=0)
    if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
If IsString($findImage) Then
    $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
Else
    $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"ptr",$findImage,"ptr",$HBMP)
EndIf
    if $result[0]="0" then return 0
    $array = StringSplit($result[0],"|")
   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
;=============================================================================

Now, it's supposed to find the image, right click it, and then return the mouse to the original position, it's not returning i don't know why, maybe i'll investigate later.

ImageSearchDLL.dll

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

Thanks for the tip, Nine. Got me digging deeper for an AutoIT solution. Actually, it led me to a post at 

From that post, I created an AutoIT script to handle the system tray perfectly. EG is EventGhost and I can execute the AutoIT script from it to solve my automation problem! Now to check out Careca's idea above too!

Edited by wysocki

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...