Page 1 of 1

urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 4:37 am
by tutenchamun
hi everybody,
I am about to write a script, that automacically generates artis playlists for all mp3's on a synched flashdrive.

There is one missing bit to it, how am I ablte to get the actual driveletter of the removable drive.
I currently only find the mediID string (looks very windows device'ish).
I've spent hours now to work through the api .but had no success so far.

any suggestions ?

please help

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 5:07 am
by Bex
http://www.mediamonkey.com/wiki/index.p ... riveLetter
It returns a long so you need to to add 65 to it and use Chr() to get the actual letter:
DriveLetterStr=Chr(Media.DriveLetter+65)

But what do you start with, MediaID , serialnumber or something else?

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 7:45 am
by tutenchamun
hm ... need to to think about it ...

I started of, selecting the device in the treenode manually - then start the script and figure it all out through the actual selected node ... and do a view sql statements - it is all there in the db apart from the drive letter ... thats then where i hung ...

I had it all working already, as earlier versions had the drive-letter within brackets under the node-caption - thats gone now ... so ...

I#ll get back to here as soon as found a way.

thanks so far

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 12:31 pm
by Guest
im not at all getting there ... the media object is of no use, if I cannot find out how to instaciate it with the currently selected device and then access it.

I#m thinking to go through MyComputer and search for the device caption and then extract the driveletter.

I do not want to believe that this all would not work easier ... I just cant find the right api calls.

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 2:22 pm
by Eyal
SDBDevice or SDBDeviceList ?

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 2:59 pm
by Guest
... i now did exactly that, browse through the mycomputer child nodes searching for the caption of the selected removeable media ... extract the DriveLetter from this nodes caption and use it ... fine ... works

still, I have the feeling, there is an api call doing this ... I just couldnt figure it out ...

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 3:01 pm
by Guest
--- I tried the SDBDevie and List, but this does not contain the DriveLetters.
Iterating through the Devices, I found the ID's, but no letters, even the DriveLetterIndex of all disks is "-1" - apart from one USB controller - "8"

Re: urgent help: find out the drive letter of the flashdisk

Posted: Sat Dec 26, 2009 4:34 pm
by Bex
So try, Chr(8+65), I think that should give you the driveletter.