Retrieving the Volume Serial Number |
|
Note that if you point it to the "A" drive, you will get either "0000-0000" or will get a "Disk not found" result (depending on your version of Windows), and if you point it to a removeable drive (like a CD or Zip drive) and there is no media in the drive, you will get a "Disk not found" response.
on mouseUp
answer GetVolumeSN("C")
end mouseUp
function GetVolumeSN pDiskLetter
local volumeSerialNumber
-- Supports both "C", "C:" and "C:\" styles
put char 1 of pDiskLetter & ":" into pDisk
set the hideConsoleWindows to true
put shell("dir " & pDisk) into tDirData
return (word -1 of line 2 of tDirData)
end GetVolumeSN