Skip to content

Commit

Permalink
- Additional fixes for Windows 10 user profile spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
rbreaves committed Aug 24, 2020
1 parent b1c3610 commit 0a5c526
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions windows/detectUSB.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ WinHide % "ahk_id " DllCall("GetConsoleWindow", "ptr")
notify_change(wParam, lParam, msg, hwnd)
{
global lastkb
; kbtype = % ComObjCreate("WScript.Shell").Exec("cscript /nologo usb.vbs").StdOut.ReadAll()
DetectHiddenWindows On
Run %ComSpec%,, Hide, pid
WinWait ahk_pid %pid%
DllCall("AttachConsole", "UInt", pid)
WshShell := ComObjCreate("Wscript.Shell")
exec := WshShell.Exec("cscript /nologo usb.vbs")
exec := WshShell.Exec("cscript /nologo ""%userprofile%\.kinto\usb.vbs""")
kbtype := exec.StdOut.ReadAll()
DllCall("FreeConsole")
Process Close, %pid%
Expand Down
12 changes: 7 additions & 5 deletions windows/usb.vbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Option Explicit
Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID
Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID, deviceID

' add item to array
Function AddItem(arr, val)
Expand Down Expand Up @@ -49,21 +49,23 @@ Dim nonApple: nonApple = 0
Dim i

If vcount = 1 Then
deviceID = deviceVID(0)
If StrComp(deviceVID(0), "05AC") = 0 Then
Wscript.Echo "Apple"
Wscript.Echo "Apple " & deviceID
Else
Wscript.Echo "Windows"
Wscript.Echo "Windows " & deviceID
End If
Else
For i = 0 To counter-1
deviceID = deviceVID(i)
If StrComp(deviceVID(i), "05AC") = -1 Then
nonApple = 1
End If
Next
If nonApple = 1 Then
Wscript.Echo "Windows"
Wscript.Echo "Windows " & deviceID
Else
Wscript.Echo "Apple"
Wscript.Echo "Apple " & deviceID
End If
End If

Expand Down

0 comments on commit 0a5c526

Please sign in to comment.