 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SKAN
Joined: 26 Dec 2005 Posts: 5298
|
Posted: Fri Dec 28, 2007 5:05 pm Post subject: |
|
|
The following works for me:
| Code: | DriveGet, DrvList, List, REMOVABLE
Loop, Parse, DrvList
{
DriveGet, DrvSerial, Serial, %A_Loopfield%:
If ( DrvSerial = 0x34333231+0 ) {
Kingston := A_LoopField ":"
Break
} }
MsgBox, % DevEject( Kingston )
DevEject( Drive="" ) {
IfNotExist, %Drive%\, Return 4
IfNotExist, DevEject.exe, Return -1
RunWait, DevEject.exe -EjectDrive:%Drive%,, Hide UseErrorLevel
Err := ErrorLevel
DriveGet, Status, Status, %Drive%
Return ( Status="Invalid" ) ? 0 : ( Err=0 ) ? 16 : Err
} |
Replace the serial in red with 7CFK5E15 ( The +0 is redundant )
 |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Dec 28, 2007 5:52 pm Post subject: |
|
|
yes that works, thanks
is it suppose to be blank lines every other line now?
when i choose copy above the code i get that behavior ..maybe since i updated my browser .... |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5298
|
Posted: Fri Dec 28, 2007 5:55 pm Post subject: |
|
|
| Anonymous wrote: | | is it suppose to be blank lines every other line now? |
No! Which browser are you using ? |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Dec 28, 2007 5:55 pm Post subject: |
|
|
| wow fast reply im using Opera 9.25 |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Dec 28, 2007 5:57 pm Post subject: |
|
|
| hmm its not opera its scite's ...hmm |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5298
|
Posted: Fri Dec 28, 2007 5:59 pm Post subject: |
|
|
You may try doing the following before pasting:
| Code: | | StringReplace, clipboard, clipboard, `r`n, n, All |
 |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Dec 28, 2007 6:07 pm Post subject: |
|
|
how do i use that line of code? i tested a #persistant script and that didnt work ..
when using the button its fine when pasting to notepad
when using selection over the code its ok in scite
...this is wierd i havnt noticed this before and ive used the button before |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5298
|
Posted: Fri Dec 28, 2007 8:27 pm Post subject: |
|
|
Try pasting it in notepad and then open it with scite ..  |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Dec 29, 2007 11:00 am Post subject: |
|
|
i think i rather make selection uand copy until i understand what the problem might be.
but regarding deveject:
it doesnt work with my mp3. It got a longer serialnr (16char) and its a iAudio U2
i checked with USBDeview and it has the same USB Class as Kingston and type says Mass Storage aswell.
any ideas? |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Dec 29, 2007 11:04 am Post subject: |
|
|
i forgot to say that get_id.ahk didnt give me a serial for this device
and i just noticed that the serial i got with ahk for Kingston isnt the same in USBDeview. |
|
| Back to top |
|
 |
A_Guest Guest
|
Posted: Tue Jan 01, 2008 9:28 pm Post subject: |
|
|
I want to run Deveject from the device thats suppose to eject. Can i achieve this without copying files to the computer that ive plugged in to ?
when i tried it with deveject it doesnt work but ive found another util that does this ...dont know how though
USBDiskEjector1.0
http://quick.mixnmojo.com/ |
|
| Back to top |
|
 |
ProsperousOne
Joined: 19 Sep 2005 Posts: 90
|
Posted: Thu Apr 17, 2008 8:38 pm Post subject: |
|
|
Took me a while to get this working, so here's some tips:
Use this script from the help file to get your serial numbers and info:
| Code: | ; This is a working example script.
FileSelectFolder, folder, , 3, Pick a drive to analyze:
if folder =
return
DriveGet, list, list, REMOVABLE
msgbox, %list%
DriveGet, cap, capacity, %folder%
DrivespaceFree, free, %folder%
DriveGet, fs, fs, %folder%
DriveGet, label, label, %folder%
DriveGet, serial, serial, %folder%
DriveGet, type, type, %folder%
DriveGet, status, status, %folder%
MsgBox All Drives: %list%`nSelected Drive: %folder%`nDrive Type: %type%`nStatus: %status%`nCapacity: %cap% M`nFree Space: %free% M`nFilesystem: %fs%`nVolume Label: %label%`nSerial Number: %serial%
|
(BTW, I just found out that you can hit CTRL+C to copy any message box!!! wish I'd known that a year ago!!! )
Also, you need to remove the hex formatting in the "If ( DrvSerial =" line, so it's just decimal serial number (ie, "12345", not "0x12345" when using the output form the above script). (I may be wrong, so if you have letters a-f in your id, you may have a hex serial number. In that case, preceed your serial number with 0x)
Here's my final code, using the Pause Hot Key to eject the drive. Also, in stead of an error code, you get either a Success or Failure message box that times out after 2 seconds.
Replace ***SERIAL NUMBER*** in the script below with the decimal serial number retreived above.
| Code: | Pause::
DriveGet, DrvList, List, REMOVABLE
Loop, Parse, DrvList
{
DriveGet, DrvSerial, Serial, %A_Loopfield%:
If ( DrvSerial = ***SERIAL*** )
{
USBdrive := A_LoopField ":"
Break
}
}
EjectStatus :=DevEject( USBdrive )
If !EjectStatus
MsgBox, 64, Eject Device, Success, 2
Else
MsgBox, 16, Eject Device, Eject Failure!, 2
Return
DevEject( Drive="" )
{
IfNotExist, %Drive%\, Return 4
IfNotExist, DevEject.exe, Return -1
RunWait, %A_ScriptDir%\DevEject.exe -EjectDrive:%Drive% ,, Hide UseErrorLevel
Err := ErrorLevel
DriveGet, Status, Status, %Drive%
Return ( Status="Invalid" ) ? 0 : ( Err=0 ) ? 16 : Err
}
Return |
|
|
| Back to top |
|
 |
ProsperousOne
Joined: 19 Sep 2005 Posts: 90
|
Posted: Fri Apr 18, 2008 3:34 am Post subject: |
|
|
I just used my usb stick on my home computer, and got a different serial number!!!!
WTF????
It's a work supplied encryped flash drive, but I assume the serial number should stay constant from computer to computer. I'll see if it has a different id at work tomorrow on the same computer...
grrrrrrrrrrrrrrrrrrrrrrrrrrrrr....... |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|