How can I escape them?
I'm using RegRead and RegWrite.

I have searched and found this:
https://autohotkey.com/board/topic/96759-run-a-filename-that-contains-a-comma/
But I'm scared to try it. I don't wanna mess up my Registry xD
Thanks very much!
Code: Select all
072: RegWrite,REG_BINARY,HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{d0649ed1-77fc-4bd5-a5f6-cf5600c5136f}\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},1,%Listen1Ch
073: }
077: Return (60.08)
Code: Select all
x::
regread,Listen1,HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{d0649ed1-77fc-4bd5-a5f6-cf5600c5136f}\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4}`,1
Listen1State := SubStr(Listen1, 17, 4)
Listen1First := SubStr(Listen1, 1, 16)
Listen1Last := SubStr(Listen1, 21)
If (Listen1State = "ffff") {
Listen1Change := Listen1First . "0000" . Listen1Last
Listen1Length := StrLen(Listen1)
Listen1ChangeLength := StrLen(Listen1Change)
If (Listen1Length != Listen1ChangeLength) {
MsgBox, "Lengths don't match."
return
}
RegWrite,REG_BINARY,HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{d0649ed1-77fc-4bd5-a5f6-cf5600c5136f}\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4}`,1,%Listen1Change%
}
Else If (Listen1State = "0000") {
Listen1Change := Listen1First . "ffff" . Listen1Last
Listen1Length := StrLen(Listen1)
Listen1ChangeLength := StrLen(Listen1Change)
If (Listen1Length != Listen1ChangeLength) {
MsgBox, "Lengths don't match."
return
}
RegWrite,REG_BINARY,HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{d0649ed1-77fc-4bd5-a5f6-cf5600c5136f}\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4}`,1,%Listen1Change%
}
Else {
MsgBox, "What is cheese?! `n(idk what happened xd)"
}
return
Code: Select all
RegWrite,REG_BINARY,HKLM,SOFTWARE\...\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4}`,1,%Listen1Change%
Refer to this:XShayanX wrote: ↑12 Sep 2019, 16:35Wait is it possible to write a variable to a registry value?Code: Select all
RegWrite,REG_BINARY,HKLM,SOFTWARE\...\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4}`,1,%Listen1Change%
Code: Select all
RegWrite,REG_BINARY,HKLM\SOFTWARE\...\Properties,{24dbb0fc-9311-4b3d-9cf0-18ff155639d4}`,1,%Listen1Change%
Try adding msgbox %Listen1Change% prior to the RegWrite and see if it's a valid value.XShayanX wrote: ↑12 Sep 2019, 17:05I was using the old syntax: RegWrite, ValueType, RootKey, SubKey , ValueName, Value
Regardless, I used the new syntax as you suggested but to no avail.
I check the registry value, and it still does not change after I press my hotkey.
At this point I'm really doubting regwrite supports %variables%
Code: Select all
Listen1[24 of 63]: 0B0000000100000000000000
Listen1Change[24 of 63]: 0B00000001000000ffff0000
Listen1ChangeLength[2 of 3]: 24
Listen1First[16 of 63]: 0B00000001000000
Listen1Last[4 of 7]: 0000
Listen1Length[2 of 3]: 24
Listen1State[4 of 7]: 0000
Code: Select all
#NoEnv
RegKey := "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{d0649ed1-77fc-4bd5-a5f6-cf5600c5136f}\Properties"
RegVal := "{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},1"
RegRead, Listen1, %RegKey%, %RegVal%
If (ErrorLevel) {
MsgBox, 16, Error!, Error when trying to read the registry: %A_LastError%
ExitApp
}
RegWrite, REG_BINARY, %RegKey%, %RegVal%, %Listen1%
If (ErrorLevel) {
MsgBox, 16, Error!, Error when trying to write the registry: %A_LastError%
ExitApp
}
MsgBox, 0, Success, All right!
ExitApp
Code: Select all
if not A_IsAdmin
Run *RunAs "%A_ScriptFullPath%"