Git Product home page Git Product logo

deviceidpnp's Introduction

DeviceIDFinder

AutoHotkey script to find your device's unique IDs.

DeviceIDPnP

AutoHotkey script to automatically launch actions when devices are connected or disconnected.

New

  • Updated to AutoHotkey v2.
  • Added support for groups of devices.
  • Option to launch or not launch the device's actions when the script starts.
  • Option to show or hide tooltips in the top left corner.

Supported devices

  • USB, Bluetooth, HDMI etc...

Requirement

  • AutoHotkey v2

Instructions

  • Run "DeviceIDFinder.ahk" to identify your devices.
  • Add your device's IDs and device's names at the top of the script (DeviceIDPnP.ahk). The device's names doesn't have to exactly match the names found with "DeviceIDFinder.ahk". You can name them whatever you want.
  • Add the device's names and the actions that you want to launch when the devices are connected or disconnected.

Options

  • DeviceName

Names of the device(s). The same name is used to launch the associated device's actions.

  • DeviceID

IDs for the device(s).

  • For one device:

    MyDevices.Add({DeviceName:"DeviceName", DeviceID:"DeviceID"})
    
  • For group of devices: Use |&| as a separator.

    MyDevices.Add({DeviceName:"DeviceName", DeviceID:"DeviceID |&| DeviceID", DevicesMatchMode:2})
    
  • DevicesMatchMode

    • 1 = All the devices in "DeviceID" must be connected (Default).

    • 2 = One device in "DeviceID" must be connected.

  • ActionAtStartup

    • true = The device's actions are launched when the script starts (Default).

    • false = The device's actions are not launched when the script starts.

  • Tooltip

    • true = Show the tooltip in the top left corner (Default).

    • false = Don't show the tooltip in the top left corner.

  • Options example

    MyDevices.Add({DeviceName:"DeviceName", DeviceID:"DeviceID |&| DeviceID", DevicesMatchMode:2, ActionAtStartup:"false", Tooltip:"false"})
    

Syntax differences from DeviceIDPnP 1.2.0

  oMyDevices.Push({"DeviceName":"DeviceName", "DeviceID":"DeviceID"}) 
   
  Now => MyDevices.Add({DeviceName:"DeviceName", DeviceID:"DeviceID"})

  DevicesActions(ThisDeviceStatusHasChanged) 

  Now => DevicesActions(thisDeviceStatus)

Copyright and License

  • MIT License

Credits

  • AutoHotkey

    • Authors: Chris Mallett and Steve Gray (Lexikos), with portions by AutoIt Team and various AHK community members.
    • License: GNU General public license
    • Info and source code at: https://autohotkey.com/
  • jNizM

  • Thanks to AHK community members for the help

    • mikeyww, teadrinker, swagfag, just me, jNizM, FanaticGuru, sofista, boiler and others.

deviceidpnp's People

Contributors

xmcqcx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

deviceidpnp's Issues

Not detecting HDMI connection properly.

Thank you for the script, it's a huge lifesaver for my use case with KVM switch, I encounter some issues and I'd appreciate any help.

I'm currently using version 1.2.0 for AutoHotkey 1.0 from your commit history, and I have HDMI monitor hooked up to a KVM switch to my main PC and work laptop. The idea is that if I switch KVM with hotkey, it will disconnect the HDMI monitor from my main PC, and then it should switch video signals to my laptop. If I switch KVM with hotkey again, it will connect the HDMI monitor back to my main PC, and switch the signal to my main PC.

I'm stuck on detecting the connection status, when I connect the HDMI monitor, it says connected, and then disconnected even though it's still plugged in. When I disconnect the HDMI monitor, it says disconnected and nothing else. Which is correct. Do you have any ideas on what could be the issue? Thanks!

oMyDevices := {}
oMyDevices.Push({"DeviceName":"Generic Monitor (HDMI)", "DeviceID":"DISPLAY\XXX0133\5&707AA03&2&UID45312"})

DevicesActions(ThisDeviceStatusHasChanged) {

    If (ThisDeviceStatusHasChanged = "Generic Monitor (HDMI) Connected")
            voice := ComObjCreate("SAPI.SpVoice")
            ;voice.rate := -10
            voice.volume := 100
         voice.Speak("Connected")

    If (ThisDeviceStatusHasChanged = "Generic Monitor (HDMI) Disconnected")
            voice := ComObjCreate("SAPI.SpVoice")
            ;voice.rate := -10
            voice.volume := 100
         voice.Speak("Disconnected")

Below is the list of DeviceID from DeviceIDFinder.ahk when toggling KVM switch

HID-compliant consumer control device:
HID\VID_046D&PID_C539&MI_01&COL02\E&48D3944&0&0001

HID-compliant mouse:
HID\VID_046D&PID_C539&MI_01&COL01\E&48D3944&0&0000

Microphone (FIFINE K678 Microphone):
SWD\MMDEVAPI\{0.0.1.00000000}.{5F8FF0C5-DD7E-4FC7-B90B-C3C9EE0F24F5}

USB Input Device:
USB\VID_046D&PID_C539&MI_02\D&2A09E01C&0&0002

HID-compliant headset:
HID\VID_3142&PID_0002&MI_03&COL02\8&25C062B9&0&0001

USB Input Device:
USB\VID_3142&PID_0002&MI_03\7&665864A&0&0003

Generic USB Hub:
USB\VID_214B&PID_7250\B&3A944CE5&0&2

HID-compliant vendor-defined device:
HID\VID_046D&PID_C539&MI_02&COL01\E&1F4A047E&0&0000

FIFINE K678 Microphone:
USB\VID_3142&PID_0002&MI_00\7&665864A&0&0000

G502 LIGHTSPEED:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT00

LIGHTSPEED Receiver:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT01

LIGHTSPEED Receiver:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT02

LIGHTSPEED Receiver:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT03

LIGHTSPEED Receiver:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT04

LIGHTSPEED Receiver:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT05

LIGHTSPEED Receiver:
USB\VID_046D&PID_C539&LAMPARRAY\D&2A09E01C&0&4_SLOT06

Generic Monitor (HDMI):
DISPLAY\XXX0133\5&707AA03&2&UID45312

USB Billboard Device   :
USB\VID_2109&PID_8817\0000000000000001

HID-compliant vendor-defined device:
HID\VID_046D&PID_C539&MI_02&COL02\E&1F4A047E&0&0001

G502 LIGHTSPEED:
USB\VID_046D&PID_C539\C&F49C187&0&4

Generic SuperSpeed USB Hub:
USB\VID_2109&PID_0817\MSFT30000000000

HID-compliant vendor-defined device:
HID\VID_046D&PID_C539&MI_02&COL03\E&1F4A047E&0&0002

HID Keyboard Device:
HID\VID_046D&PID_C539&MI_00\E&28647706&0&0000

USB Input Device:
USB\VID_046D&PID_C539&MI_00\D&2A09E01C&0&0000

Generic USB Hub:
USB\VID_2109&PID_2817\MSFT20000000000

USB Input Device:
USB\VID_046D&PID_C539&MI_01\D&2A09E01C&0&0001

USB Composite Device:
USB\VID_3142&PID_0002\REV1.0

HID-compliant consumer control device:
HID\VID_3142&PID_0002&MI_03&COL01\8&25C062B9&0&0000

HID-compliant vendor-defined device:
HID\VID_046D&PID_C539&MI_01&COL04\E&48D3944&0&0003

HID-compliant system controller:
HID\VID_046D&PID_C539&MI_01&COL03\E&48D3944&0&0002

Name of the script

Hi

Just a doubt. Is it possible to change the name of your ahk script? Why it doesn't work if changed? Maybe it is not recommendable?

Best regards

Note: adding this to the Winclose script made it to work, maybe it would be good to add to the default:
DetectHiddenWindows(true)

Multiple devices

Hello, I'm trying to do the following: In oMyDevices.Push, I put the DeviceID of 2 devices. I want it to only execute the action when they are connected. It works. But I also wanted it to display an error when they are not connected. So I added the two separately in oMyDevices.Push, but when I pull a device it performs the action. Is there a way to do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.