매크로

조회 수 212 추천 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
분류 제목 글쓴이 최근변경 추천
질문 숫자이미지를 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
질문 루프에서 변수값 호출에 관한 질문입니다 ㅠ 2 화프 2016.04.04 0/0
질문 외치기님이 올려주신 푸쉬블엣을 오핫이용해서 사용중... 3 지니블렉션 2016.03.29 0/0
질문 gui 드롭다운리스트 질문드려요 6 쵸쵸 2016.03.05 0/0
질문 원클릭 블루스택 해상도 설정 방법 4 파랑상 2016.03.12 0/0
질문 메이플매크로/인식이안되도 스크립이 진행되는문제 2 세나블텍 2016.03.04 0/0
질문 gdip 범위지정서치 질문합니다. 8 N4N2 2017.09.07 0/0
질문 블루스택에서 ESC키 입력하는 법 질문드립니다. 2 amoure 2016.03.04 0/0
질문 특정위치 클릭 방법 질문 드리겠습니다. 5 까스배달소년 2016.03.29 0/0
질문 OCR 과 이미지서치 문제가 안풀립니다.. 6 뎅뎅 2016.03.06 0/0
질문 Gui combobox 관련 질문 드립니다. 2 덩구리얌 2016.03.04 0/0
질문 듀얼모니터 이미지서치 방법좀요 1 사군자vv 2016.03.04 0/0
Board Pagination Prev 1 ... 125126127128129130131132133 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글