Skip to content

Commit ff6f8dd

Browse files
committed
a?
1 parent 3c4fc89 commit ff6f8dd

24 files changed

+768
-516
lines changed

.vscode/launch.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
"program": "",
88
"stopOnEntry": true
99
},
10-
{
11-
"type": "ahk",
12-
"request": "launch",
13-
"name": "AutoHotkey v1 Debugger",
14-
"program": "",
15-
"stopOnEntry": true,
16-
"runtimeArgs": ["/extra"]
17-
}
10+
{
11+
"type": "ahk",
12+
"request": "launch",
13+
"name": "AutoHotkey v1 Debugger",
14+
"program": "",
15+
"stopOnEntry": true
16+
}
1817
]
1918
}

lib/bluscream.ahk

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -312,30 +312,34 @@ ShellRun(prms*)
312312
desktop := shellWindows.Item(ComObj(19, 8)) ; VT_UI4, SCW_DESKTOP
313313

314314
; Retrieve top-level browser object.
315-
if ptlb := ComObjQuery(desktop
316-
, "{4C96BE40-915C-11CF-99D3-00AA004AE837}" ; SID_STopLevelBrowser
317-
, "{000214E2-0000-0000-C000-000000000046}") ; IID_IShellBrowser
318-
{
319-
; IShellBrowser.QueryActiveShellView -> IShellView
320-
if DllCall(NumGet(NumGet(ptlb+0)+15*A_PtrSize), "ptr", ptlb, "ptr*", psv:=0) = 0
315+
try {
316+
if ptlb := ComObjQuery(desktop
317+
, "{4C96BE40-915C-11CF-99D3-00AA004AE837}" ; SID_STopLevelBrowser
318+
, "{000214E2-0000-0000-C000-000000000046}") ; IID_IShellBrowser
321319
{
322-
; Define IID_IDispatch.
323-
VarSetCapacity(IID_IDispatch, 16)
324-
NumPut(0x46000000000000C0, NumPut(0x20400, IID_IDispatch, "int64"), "int64")
325-
326-
; IShellView.GetItemObject -> IDispatch (object which implements IShellFolderViewDual)
327-
DllCall(NumGet(NumGet(psv+0)+15*A_PtrSize), "ptr", psv
328-
, "uint", 0, "ptr", &IID_IDispatch, "ptr*", pdisp:=0)
329-
330-
; Get Shell object.
331-
shell := ComObj(9,pdisp,1).Application
332-
333-
; IShellDispatch2.ShellExecute
334-
shell.ShellExecute(prms*)
335-
336-
ObjRelease(psv)
320+
; IShellBrowser.QueryActiveShellView -> IShellView
321+
if DllCall(NumGet(NumGet(ptlb+0)+15*A_PtrSize), "ptr", ptlb, "ptr*", psv:=0) = 0
322+
{
323+
; Define IID_IDispatch.
324+
VarSetCapacity(IID_IDispatch, 16)
325+
NumPut(0x46000000000000C0, NumPut(0x20400, IID_IDispatch, "int64"), "int64")
326+
327+
; IShellView.GetItemObject -> IDispatch (object which implements IShellFolderViewDual)
328+
DllCall(NumGet(NumGet(psv+0)+15*A_PtrSize), "ptr", psv
329+
, "uint", 0, "ptr", &IID_IDispatch, "ptr*", pdisp:=0)
330+
331+
; Get Shell object.
332+
shell := ComObj(9,pdisp,1).Application
333+
334+
; IShellDispatch2.ShellExecute
335+
shell.ShellExecute(prms*)
336+
337+
ObjRelease(psv)
338+
}
339+
ObjRelease(ptlb)
337340
}
338-
ObjRelease(ptlb)
341+
} catch e {
342+
scriptlog("Error in ShellRun: " . e.Message)
339343
}
340344
}
341345
EnforceAdmin(args:="") {

lib/bluscream/io/paths.ahk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
EnvGet, localappdata, % "LOCALAPPDATA"
2+
EnvGet, userprofile, % "USERPROFILE"
3+
24
class Paths {
35
class User {
46
name := A_UserName ; blusc
7+
userprofile := new Directory(userprofile)
58
appdata := new Directory(A_AppData) ; C:\Users\blusc\AppData\Roaming
69
localappdata := new Directory(localappdata) ; C:\Users\blusc\AppData\Local
7-
; locallowappdata := new Directory(localappdata) ; C:\Users\blusc\AppData\LocalLow
10+
locallowappdata := new Directory(StrReplace(localappdata, "\Local", "\LocalLow")) ; C:\Users\blusc\AppData\LocalLow
811
temp := new Directory(A_Temp) ; C:\Users\blusc\AppData\Local\Temp
912
desktop := new Directory(A_Desktop) ; C:\Users\blusc\Desktop
1013
startmenu := new Directory(A_StartMenu) ; C:\Users\blusc\AppData\Roaming\Microsoft\Windows\Start Menu

lib/virtual_desktop.ahk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class VirtualDesktop {
2222
this.streamer_path := this.dir.CombineFile(this.windows.streamer.exe)
2323
}
2424
this.connected := this.windows.server.process.exists()
25+
scriptlog("Loaded VD Lib")
2526
}
2627

2728
init() {

scripts/SoundSet-Script.ahk

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
SetBatchLines -1
2+
SplashTextOn,,, Gathering Soundcard Info...
3+
4+
; Most of the pure numbers below probably don't exist in any mixer, but they're queried for completeness.
5+
; The numbers correspond to the following items (in order): CUSTOM, BOOLEANMETER, SIGNEDMETER, PEAKMETER,
6+
; UNSIGNEDMETER, BOOLEAN, BUTTON, DECIBELS, SIGNED, UNSIGNED, PERCENT, SLIDER, FADER, SINGLESELECT, MUX,
7+
; MULTIPLESELECT, MIXER, MICROTIME, MILLITIME
8+
ControlTypes := "VOLUME,ONOFF,MUTE,MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,QSOUNDPAN,BASS,TREBLE,EQUALIZER,0x00000000, 0x10010000,0x10020000,0x10020001,0x10030000,0x20010000,0x21010000,0x30040000,0x30020000,0x30030000,0x30050000,0x40020000,0x50030000,0x70010000,0x70010001,0x71010000,0x71010001,0x60030000,0x61030000"
9+
10+
ComponentTypes := "MASTER,HEADPHONES,DIGITAL,LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A"
11+
12+
; Create a ListView and prepare for the main loop:
13+
Gui, Add, ListView, w400 h400 vMyListView, Component Type|Control Type|Setting|Mixer
14+
LV_ModifyCol(4, "Integer")
15+
SetFormat, Float, 0.2 ; Limit number of decimal places in percentages to two.
16+
17+
Loop ; For each mixer number that exists in the system, query its capabilities.
18+
{
19+
CurrMixer := A_Index
20+
SoundGet, Setting,,, %CurrMixer%
21+
if (ErrorLevel = "Can't Open Specified Mixer") ; Any error other than this indicates that the mixer exists.
22+
break
23+
24+
; For each component type that exists in this mixer, query its instances and control types:
25+
Loop, parse, ComponentTypes, `,
26+
{
27+
CurrComponent := A_LoopField
28+
; First check if this component type even exists in the mixer:
29+
SoundGet, Setting, %CurrComponent%,, %CurrMixer%
30+
if (ErrorLevel = "Mixer Doesn't Support This Component Type")
31+
continue ; Start a new iteration to move on to the next component type.
32+
Loop ; For each instance of this component type, query its control types.
33+
{
34+
CurrInstance := A_Index
35+
; First check if this instance of this instance even exists in the mixer:
36+
SoundGet, Setting, %CurrComponent%:%CurrInstance%,, %CurrMixer%
37+
; Checking for both of the following errors allows this script to run on older versions:
38+
if ErrorLevel in Mixer Doesn't Have That Many of That Component Type,Invalid Control Type or Component Type
39+
break ; No more instances of this component type.
40+
; Get the current setting of each control type that exists in this instance of this component:
41+
Loop, parse, ControlTypes, `,
42+
{
43+
CurrControl := A_LoopField
44+
SoundGet, Setting, %CurrComponent%:%CurrInstance%, %CurrControl%, %CurrMixer%
45+
; Checking for both of the following errors allows this script to run on older versions:
46+
if ErrorLevel in Component Doesn't Support This Control Type,Invalid Control Type or Component Type
47+
continue
48+
if ErrorLevel ; Some other error, which is unexpected so show it in the results.
49+
Setting := ErrorLevel
50+
ComponentString := CurrComponent
51+
if (CurrInstance > 1)
52+
ComponentString := ComponentString ":" CurrInstance
53+
LV_Add("", ComponentString, CurrControl, Setting, CurrMixer)
54+
} ; For each control type.
55+
} ; For each component instance.
56+
} ; For each component type.
57+
} ; For each mixer.
58+
59+
Loop % LV_GetCount("Col") ; Auto-size each column to fit its contents.
60+
LV_ModifyCol(A_Index, "AutoHdr")
61+
62+
SplashTextOff
63+
Gui, Show
64+
return
65+
66+
GuiClose:
67+
ExitApp

scripts/adb media keys.ahk

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
adb_path := "adb"
1111
; Default behavior for volume keys
1212
HandleVolumeKeys := false
13-
device_id := "7bb16eeeb8e9c86c7578552408caede5"
13+
device_id := "dcc49f55215af97fbf50095be07931db"
1414
global no_ui := false
1515

1616
; Check for command line switches
@@ -46,19 +46,19 @@ if (adb_devices == "List of devices attached") { ; \r\n\r\n
4646
SendCommand("volume_up")
4747
else
4848
Send, {Volume_Up}
49-
return
49+
return
5050
~Volume_Down:: ; Volume Down
5151
if (HandleVolumeKeys)
5252
SendCommand("volume_down")
5353
else
5454
Send, {Volume_Down}
55-
return
55+
return
5656
~Volume_Mute:: ; Mute
5757
if (HandleVolumeKeys)
5858
SendCommand("mute")
5959
else
6060
Send, {Volume_Mute}
61-
return
61+
return
6262

6363
return ; Ensure the script keeps running
6464

@@ -140,19 +140,21 @@ MakeHASSCommand(command) {
140140
SendHASSCommand(action) {
141141
global device_id
142142
EnvGet, HASS_SERVER, HASS_SERVER
143+
EnvGet, HASS_IP, HASS_IP
144+
EnvGet, HASS_PORT, HASS_PORT
143145
EnvGet, HASS_TOKEN, HASS_TOKEN
144146
HASS_TOKEN := "Bearer " . HASS_TOKEN
145147

146-
url := HASS_SERVER . "/api/services/" . action
147-
; scriptlog(url)
148+
url := "http://" HASS_IP . ":" . HASS_PORT . "/api/services/" . action
149+
; url := HASS_SERVER . "/api/services/" . action
150+
scriptlog(url)
148151
payload := { "device_id": device_id }
149152
jsonPayload := toJson(payload, false) ; "{""target"": {""device_id"": """ device_id """}}"
150153
; scriptlog(jsonPayload)
151154

152155
; scriptlog("Sending hass command: " . jsonPayload)
153156
if (startsWith(url, "https:")) {
154-
; Set up the HTTP request headers
155-
http := ComObjCreate("MSXML2.XMLHTTP")
157+
http := ComObjCreate("MSXML2.XMLHTTP") ; Set up the HTTP request headers
156158
http.Open("POST", url, true)
157159
http.setRequestHeader("Authorization", HASS_TOKEN)
158160
http.setRequestHeader("Content-Type", "application/json")

scripts/bbr.ahk

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#NoEnv
1+
; #NoEnv
22
#SingleInstance, Force
33
#Persistent
44
SendMode, Input
@@ -10,26 +10,39 @@ SetWorkingDir, %A_ScriptDir%
1010
#Include <bluscream>
1111

1212
global no_ui := false
13+
global userpaths := new Paths().User
14+
userpaths := new userpaths()
15+
1316
scriptlog("bbr.ahk::start")
1417
15-
global net_log_path := "C:\Users\blusc\scoop\apps\currports\current\cports.log" ; "D:\WSCC\Apps\NirSoft Utilities\CurrPorts (x64)\cports.log" ; "H:\WSCC\Apps\x64\cports.log"
18+
global net_log_path := userpaths.userprofile.CombineFile("scoop","apps","currports","current","cports.csv").Path ; .temp ; "C:\Users\blusc\scoop\apps\currports\current\cports.log" ; "D:\WSCC\Apps\NirSoft Utilities\CurrPorts (x64)\cports.log" ; "H:\WSCC\Apps\x64\cports.log"
1619
; global net_ref_keys:=["prefix","Added_On","State","Protocol","Local_Address","Local_Port","Local_Port_Name","Remote_Address","Remote_Port","Remote_Port_Name","Remote_Host_Name","Remote_IPCountry","Process_Created_On","Process_ID","Process_Name","Process_Path","Process_Services","Process_Attributes","Window_Title","Product_Name","File_Description","File_Version","Company","Module_Filename","User_Name"]
1720
; ;"%Added_On%";"%State%";"%Protocol%";"%Local_Address%";"%Local_Port%";"%Local_Port_Name%";"%Remote_Address%";"%Remote_Port%";"%Remote_Port_Name%";"%Remote_Host_Name%";"%Remote_IP Country%";"%Process_Created_On%";"%Process_ID%";"%Process_Name%";"%Process_Path%";"%Process_Services%";"%Process_Attributes%";"%Window_Title%";"%Product_Name%";"%File_Description%";"%File_Version%";"%Company%";"%Module_Filename%";"%User_Name%";
1821
global net_process_name := "BattleBit.exe"
1922

20-
global log_path := "C:\Users\blusc\AppData\LocalLow\BattleBitDevTeam\BattleBit\Player.log"
23+
global log_path := userpaths.locallowappdata.CombineFile("BattleBitDevTeam","BattleBit","Player.log").Path ; "C:\Users\blusc\AppData\LocalLow\BattleBitDevTeam\BattleBit\Player.log"
2124
global title := "BattleBit Remastered"
22-
global icon := "G:\SteamLibrary\steamapps\common\BattleBit Remastered\IconGroup103.ico"
23-
Menu, Tray, Icon, % icon
25+
global icon := new File("D:\SteamLibrary\steamapps\common\BattleBit Remastered\IconGroup103.ico").Path
26+
if (FileExist(icon)) {
27+
Menu, Tray, Icon, % icon
28+
}
2429

2530
; global last_join_addr := ""
31+
OnExit("ExitFunc")
2632

2733
lt := new LogTailer(log_path, Func("OnNewLine"), true)
28-
lt := new LogTailer(net_log_path, Func("OnNewNetLine"), true)
34+
lt2 := new LogTailer(net_log_path, Func("OnNewNetLine"), true)
2935
ShowToast(title, "AutoHotkey", icon, "topleft", 5)
3036
scriptlog("bbr.ahk::end")
3137
return
3238

39+
ExitFunc() {
40+
if (FileExist(net_log_path)) {
41+
FileDelete, % net_log_path
42+
}
43+
ExitApp
44+
}
45+
3346
Toast(message, _title := "BattleBit Remastered", time_seconds := 10) {
3447
global icon, title
3548
if (_title == "")
116 KB
Binary file not shown.
0 Bytes
Binary file not shown.

scripts/bin/hotkeys.exe

39.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)