매크로

조회 수 209 추천 0 댓글 3
#NoEnv
#SingleInstance force
for Disk in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_DiskDrive where interfacetype = ""USB""")
{
DeviceId := Disk.PNPDeviceID
StringSplit DeviceProperties, DeviceId, \&
SerialNumber := DeviceProperties6 ; The sixth element of the array contains the serial number
MsgBox %SerialNumber%
}
return


D: 를 함수로넘겼을때 D의 고유코드를 리턴받고싶습니다. (지금은 꼽힌 모든USB를 다 가져옵니다.)
추가로 description/VenderID/ProductID도 가져올수있나요? (사례를 원하시면 드릴수있습니다.)




http://www.nirsoft.net/utils/usb_devices_view.html 
여기들어가시면 USB정보보는 포터블프로그램이있습니다.  참고!

  • profile
    모노레인 2016.03.10 02:37
    #NoEnv
    #SingleInstance force
    SetBatchLines -1
    ListLines Off

    oDevice := GetUSBInfo("F")

    MsgBox, % "Name:`t`t" oDevice.Name
            . "`nCaption:`t`t" oDevice.Caption
            . "`nDescription:`t" oDevice.Description
            . "`nInterfaceType:`t" oDevice.InterfaceType
            . "`nSerialNumber:`t" oDevice.SerialNumber
        
    return


    GetDrive(sDrive) {
        wmi := ComObjGet("winmgmts:")
        
        for LogicalDisk in wmi.ExecQuery("Select * from Win32_LogicalDiskToPartition") {
            if InStr(LogicalDisk.Dependent, sDrive) {
                for Partition in wmi.ExecQuery("Select * from Win32_DiskDriveToDiskPartition") {
                    if (Partition.Dependent = LogicalDisk.Antecedent) {
                        Start := InStr(Partition.Antecedent, """") + 1
                        return SubStr(Partition.Antecedent, Start, -1)
                    }
                }
            }
        }
    }

    GetUSBInfo(sDrive) {
        oUSBInfo    := {}
        sDeviceID    := GetDrive(sDrive)
        
        for objItem in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_DiskDrive  where DeviceId = """ sDeviceID """") { 
            oUSBInfo.Name            := objItem.Name
            oUSBInfo.Model           := objItem.Model
            oUSBInfo.DeviceID        := objItem.DeviceID
            oUSBInfo.Caption         := objItem.Caption
            oUSBInfo.Description     := objItem.Description
            oUSBInfo.InterfaceType   := objItem.InterfaceType
            oUSBInfo.SerialNumber    := objItem.SerialNumber
        }
        
        return oUSBInfo
    }
  • profile
    모노레인 2016.03.10 08:52

    VenderID/ProductID 가져오는 건 못찾았네요.

  • cjh71 2016.03.11 04:02
    wmic diskdrive where "mediatype='removable media'" get model, PNPdeviceID
    wmic로 해결! 감사합니다!

List of Articles
분류 제목 글쓴이 최근변경 추천
질문 Gdip_ImageSearch 이미지 차이 질문 2 fnwj 2016.03.26 0/0
질문 오토핫키로 F1,F2 같은 키도 누르게 할 수 있나요?? 3 메루루루 2016.03.29 0/0
자유 녹스 비활성화 붙여넣기 postmessage 1 띨빵큐라 2016.03.29 0/0
자유 COM_L.ahk 라이브러리 가지고 계신분 계신가요? 1 Hangoon 2018.01.29 0/0
질문 불규칙적으로 움직이는 이미지 파일 가리는방법이 있을... 1 개멍멍멍 2016.03.20 0/0
질문 이미지 서치 도움좀 부탁드립니다. 13 뎅뎅 2019.08.17 0/0
질문 Gdip문의 4 fnwj 2016.03.17 0/0
질문 비활성 문자입력&붙여넣기 질문드려요 1 띨빵큐라 2016.03.29 0/0
질문 adb서치 질문 1 fnwj 2016.03.16 0/0
질문 화면에 웹브라우져 여러개 띄우고 각각 다른 프록시를 ... 1 오켕 2016.03.29 0/0
자유 블택2 비활성클릭 성공하신분 잇으신가요 .. 4 미천성 2016.03.30 0/0
질문 숫자이미지를 ocr로 안되는데 혹 다른 방법 있을까용?? 2 오켕 2016.03.13 0/0
질문 이미지 비교 질문 2 풍운대사 2016.03.11 0/0
질문 이미지를 계속 누르고 있게할 방법이 있나요? 2 난느려 2016.03.29 0/0
질문 함수안에서 다른 함수를 호출할 수 있나요? 3 거룩한검 2016.03.13 0/0
질문 USB 고유코드가져오는코드인데 문법좀 바꿔주세요. 3 cjh71 2016.03.11 0/0
질문 postmessage에서 인자로 쓰이는 윈 타이틀 2 우리유미씨 2016.03.26 0/0
자유 [ 메이플 ] 매크로 사용 가능여부 1 알씨다이 2016.03.16 0/0
질문 SendMessage 또는 PostMessage 로 Gui를 Disable이 가... 1 타치코마 2016.03.10 0/0
질문 오토핫키는 생성자 같은거 없나요? 3 reavil 2016.03.12 0/0
Board Pagination Prev 1 ... 124125126127128129130131132 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글