Hey, folks!
Is there a way to determine the drive letters on a computer? I'd like my MMF2 application, at start-up, to determine all the drive letters on the computer in which it is running.
Thanks for your help!


Hey, folks!
Is there a way to determine the drive letters on a computer? I'd like my MMF2 application, at start-up, to determine all the drive letters on the computer in which it is running.
Thanks for your help!




Yes, I think the YASO System Object can do this. Oddly, so can the List object - it has a "Load drive list" action, and you can then parse the available drive letters out of it.


Hey, DavidN! Thanks for the fast reply!
When I look at the List object, I can't find an expression which would allow me to capture the list of drive letters (which would be produced from the List object's "Load drive list" action). How would I capture that text string?

Have a look at this simple example:
http://www.andersriggelsen.dk/clickt...ive-letter.mfa


Hey, Andos! Thanks for the example file!
I didn't explain why I need a list of computer drives... I am working on a music player which uses a List View object to list music tracks the end user has selected. One column in this List View object has the complete path to the audio track, and if the end user clicks on that row, a DirectShow object plays that audio track. This functionality works fine.
However, if the audio track is stored on an external hard drive which is moved from one computer to another, the drive letter may change (even though the directory path on the external hard drive hasn't changed). Then, when the music player tries to play a selected file, the DirectShow object cannot play it because the absolute path to the audio file has been broken from when that audio file was first selected by the end user.
So, an idea I had to fix this issue was to get a directory list of all drives on the computer, and when the List View object loads the list of audio files, a Fastloop would determine if each audio file in the list still existed. It might work something like this:
On Fastloop "Verify Files"
File/Directory Browser object: If (Text from List View object) doesn't exist, then check "c:\"+Middle Substring of (Text from List View object) through end of that string
On Fastloop "Verify Files"
File/Directory Browser object: If "C:\"+Middle Substring of (Text from List View object) doesn't exist, then check "D:\"+Middle Substring of (Text from List View object through end of string
...And so on, until all drive letters on the computer have been exhausted.
If the File/Directory Browser object does find that file with a different drive letter, then the application would update the List View object's path.
So, the long-story of it is that I don't need the ability for the end user to select the drive letter, but rather I need a list of drive letters so I know which letters to substitute in the Fastloop (and so I know how many times to run the Fastloop).
Any ideas on how I might be able to do this?
Thanks again for your help!




To get just the drive letters out of the list object, you could run a fastloop [number of lines in the List object] times, and replace the contents of each line with Mid$([text of List object at row LoopIndex], 2, 1) (or some expression much like that). Then, in your fastloop to verify files, you would loop for each file, trying [text of List object at row LoopIndex] + ":\etc\etc\etc" each time.
I... could see this whole method becoming rather slow, though, if you have a lot of files to verify. I don't think it's unreasonable to just assume that a file will be found in the same place each time, and just ignore it if it no longer exists...


Hey, DavidN!
Actually, my existing application has a more simplified file verification whereby it simply checks if the file exists, and if the file doesn't exist, that line from the List View object is removed. (I might mention that each time a file is added to the music player, the List View object saves the list of files externally; the same external file is imported when the music player is opened. This saves time from having to import the list from a Fastloop.)
I find that when I swap this external hard drive between computers, the music player can't find files because the computer assigns the external hard drive to different drive locations. So, I'd like to find a solution to this. Does anyone have any suggestions how I might address this issue?
Thanks!