fmen Posted July 28, 2005 Posted July 28, 2005 I have a bunch of scripts on a usb drive that I run on differnet computers. Problem is that each computer assigns my flashdrive a different letter. Is there a way of using % % around REMOVABLE DRIVE to equalize this for every computer I use. I did a search and found a great little script by a member that will find the drive letter: #include <string.au3> $usb = DriveGetDrive( "REMOVABLE" ) If NOT @error Then For $i = 1 to $usb[0] $usbdev = RegRead("HKLM\SYSTEM\MountedDevices", "\DosDevices\" & $usb[$i]) $usbrealdev = _HexToString($usbdev) If StringInStr ( $usbrealdev, "STORAGE#RemovableMedia#" ) then If DriveGetFileSystem ( $usb[$i] ) <> "NTFS" then MsgBox(0,"USB-Drive", $usb[$i]) Endif Next EndIf So how do I run a program using this information? EG: Run ( '%$usb%\FMEN\RunIt\runit.exe' ) doesn't work Thanks for any help
seandisanti Posted July 28, 2005 Posted July 28, 2005 I have a bunch of scripts on a usb drive that I run on differnet computers. Problem is that each computer assigns my flashdrive a different letter. Is there a way of using % % around REMOVABLE DRIVE to equalize this for every computer I use.I did a search and found a great little script by a member that will find the drive letter:#include <string.au3> $usb = DriveGetDrive( "REMOVABLE" ) If NOT @error Then For $i = 1 to $usb[0] $usbdev = RegRead("HKLM\SYSTEM\MountedDevices", "\DosDevices\" & $usb[$i]) $usbrealdev = _HexToString($usbdev) If StringInStr ( $usbrealdev, "STORAGE#RemovableMedia#" ) then If DriveGetFileSystem ( $usb[$i] ) <> "NTFS" then MsgBox(0,"USB-Drive", $usb[$i]) Endif Next EndIfSo how do I run a program using this information?EG:Run ( '%$usb%\FMEN\RunIt\runit.exe' ) doesn't workThanks for any help<{POST_SNAPBACK}>check out the macro reference in the help file, you may be able to find an easier way to access the drive that the script is on...
blindwig Posted July 28, 2005 Posted July 28, 2005 Are all the scripts on the same drive? And you have a master script that calls other scripts? If so, then in your master script, get it's drive letter like this: $Drive = StringLeft(@ScriptDir, 1) My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
seandisanti Posted July 28, 2005 Posted July 28, 2005 Are all the scripts on the same drive? And you have a master script that calls other scripts? If so, then in your master script, get it's drive letter like this:$Drive = StringLeft(@ScriptDir, 1)<{POST_SNAPBACK}>heh, the one time i try to make somebody think for the answer and somebody else gives it away...
Josbe Posted July 28, 2005 Posted July 28, 2005 #include <string.au3> $usb = DriveGetDrive( "REMOVABLE") If Not @error Then For $i = 1 To $usb[0] $usbdev = RegRead("HKLM\SYSTEM\MountedDevices", "\DosDevices\" & $usb[$i]) $usbrealdev = _HexToString ($usbdev) If StringInStr($usbrealdev, "STORAGE#RemovableMedia#") Then $sDeviceLetter = $usb[$i] If DriveGetFileSystem( $sDeviceLetter ) <> "NTFS" Then ;MsgBox(0, "USB-Drive", $usb[$i]) Run ( $sDeviceLetter & "\FMEN\RunIt\runit.exe" ) EndIf EndIf Next EndIf AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
fmen Posted July 28, 2005 Author Posted July 28, 2005 Terrific stuff you all. I do appreciate the help. I am sure it will work. Thanks.
jdickens Posted July 29, 2005 Posted July 29, 2005 Please, people, no more giving stuff away on the forums. :^) J If I am too verbose, just say so. You don't need to run on and on.
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