Skip to content

Commit f538478

Browse files
authored
initial commit
basic customizable file au3 format
1 parent 3a4a7fb commit f538478

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

ae_switcher.au3

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
;
2+
; Sound Blaster Command Quick Output Switcher
3+
; Just compile with Aut2Exe v3
4+
;
5+
; Keys :
6+
; + : SHIFT
7+
; ! : ALT
8+
; ^ : CTRL
9+
; # : Windows
10+
; {*} : *
11+
; {}} : }
12+
;
13+
; More at : https://www.autoitscript.com/autoit3/docs/functions/Send.htm
14+
;
15+
16+
17+
HotKeySet("+!^T", "SwitchOutput") ; CTRL + ALT + SHIFT + t (it's T because SHIFT)
18+
19+
Global $SOUNDBLASTER_WIN_TITLE = "[TITLE:Sound Blaster Command; REGEXPCLASS:HwndWrapper.*]"
20+
Global $RUNNING = True
21+
22+
;no need to import library which use more RAM for 2 globals
23+
Global $WIN_STATE_EXISTS = 1
24+
Global $WIN_STATE_VISIBLE = 2
25+
26+
Opt("WinWaitDelay", 0)
27+
AutoItSetOption("MouseCoordMode", 0)
28+
29+
While $RUNNING
30+
Sleep(99999)
31+
WEnd
32+
33+
Func SwitchOutput()
34+
Local $soundblasterWasVisible = BitAND(WinGetState($SOUNDBLASTER_WIN_TITLE), $WIN_STATE_VISIBLE)
35+
$saved_win_handle = WinGetHandle("[active]")
36+
WinSetState($saved_win_handle, "", @SW_MINIMIZE)
37+
38+
If $soundblasterWasVisible == 0 Then
39+
Local $hidReady = False
40+
41+
Run("C:\Program Files (x86)\Creative\Sound Blaster Command\Creative.SBCommand.exe")
42+
43+
While Not $hidReady
44+
Sleep(100)
45+
If WinExists($SOUNDBLASTER_WIN_TITLE) And BitAND(WinGetState($SOUNDBLASTER_WIN_TITLE), $WIN_STATE_VISIBLE) Then
46+
$hidReady = True
47+
EndIf
48+
WEnd
49+
EndIf
50+
51+
WinActivate($SOUNDBLASTER_WIN_TITLE)
52+
WinWaitActive($SOUNDBLASTER_WIN_TITLE)
53+
MouseClick("left", 53, 622, 1, 0)
54+
55+
If $soundblasterWasVisible == 0 Then
56+
WinClose($SOUNDBLASTER_WIN_TITLE, "")
57+
Else
58+
WinSetState($SOUNDBLASTER_WIN_TITLE, "", @SW_MINIMIZE)
59+
EndIf
60+
61+
WinActivate($saved_win_handle)
62+
EndFunc
63+
64+
Func Terminate()
65+
$RUNNING = False
66+
EndFunc

0 commit comments

Comments
 (0)