aa2zz6 Posted July 25, 2017 Posted July 25, 2017 (edited) We have a PC here at work that we'd like to dedicate to pulling information off handheld devices when the device is connected. I found a piece of code that registers when a device is connected, which is good but I'm not sure with what I wrote is accessing the Portable Device to move the files since nothing is getting copied over. ; ---- Copy files Portable Devices to C Drive ---- Local $Portable_Device = "\Computer\MobileMapper PocketPC\Storage Card\AutoCAD" If FileExists($Portable_Device) Then Local $FileDir = "C:\test\FILE_" $dir = DirCreate($FileDir & @MON & @MDAY & @YEAR) FileCopy($Portable_Device,$dir) ConsoleWrite("Done") EndIf #include <WindowsConstants.au3> #include <Date.au3> $Form1_1 = GUICreate("") GUIRegisterMsg($WM_DEVICECHANGE, "WM_DEVICECHANGE") GUISetState(@SW_SHOW) Do Until GUIGetMsg() = -3 Func WM_DEVICECHANGE($hWnd, $msg, $wParam, $lParam) #forceref $hWnd, $msg, $wParam, $lParam Local $DBT_DEVNODES_CHANGED = 0x00000007 Switch $wParam Case $DBT_DEVNODES_CHANGED ConsoleWrite("+wParam: " & $wParam & @CRLF & "+lParam: " & $lParam & @CRLF & @CRLF) ; ---- Copy files Portable Devices to C Drive ---- Local $Portable_Device = "\Computer\MobileMapper PocketPC\Storage Card\AutoCAD" If FileExists($Portable_Device) Then Local $FileDir = "C:\test\FILE_" $dir = DirCreate($FileDir & @MON & @MDAY & @YEAR) FileCopy($Portable_Device,$dir) ConsoleWrite("Done") EndIf EndSwitch Return 'GUI_RUNDEFMSG' EndFunc ;==>WM_DEVICECHANGE ; https://www.autoitscript.com/forum/topic/143297-how-to-activate-a-program-when-a-specific-usb-device-is-connected/ Edited July 25, 2017 by aa2zz6
Danyfirex Posted July 26, 2017 Posted July 26, 2017 (edited) Hello. You need to Implement Windows Portable Devices API. Probably You could find a commandline tool to handle this due API implementation above require a little Advanced knowledge. Good look. Saludos Edited July 26, 2017 by Danyfirex I wrote knowlegue lol Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now