Finding USB volumes on Win

Richard Miller wow at together.net
Mon Mar 22 11:00:39 EDT 2010


Richard,

This has been working for me:

  repeat with i = number of lines of the volumes down to 1
          put line i of the volumes into x
          put getvolumesn(X) into z
end repeat

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
   get matchText(tDirData,"Volume Serial Number is 
(.*)\n",volumeSerialNumber)
   if it is true then
     return volumeSerialNumber
   else
     return empty
   end if
end GetVolumeSN


Richard Miller



On 3/22/2010 10:05 AM, Richard Gaskin wrote:
> In January with the help of Phil, Peter, and others I got some great 
> tips for identifying removable drives on OS X and Linux.  But I'm 
> having difficulty figuring out how to do the same in Windows.
>
> I can find the registry entries to determine which devices are 
> mounted, but they don't contain the info which will let me know which 
> drive letter they're associated with.
>
> I've tried setting the shellCommand to "diskpart" and then using:
>
> get shell("list volume")
>
> ...but that returns "2", which means a syntax error, even though that 
> syntax works fine from the command line.
>
> Any tips on how to identify mounted removable volumes and obtain their 
> drive letters?  Extra bonus points if I could get their names too, for 
> those that have been named.
>
> TIA -
>
> -- 
>  Richard Gaskin
>  Fourth World
>  Rev training and consulting: http://www.fourthworld.com
>  Webzine for Rev developers: http://www.revjournal.com
>  revJournal blog: http://revjournal.com/blog.irv
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list