Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Don't ask to ask, just ask
 
PerlMonks  

TK - dropbox with drive mappings

by crabbdean (Pilgrim)
on Apr 01, 2004 at 05:30 UTC ( #341515=perlquestion: print w/ replies, xml ) Need Help??
crabbdean has asked for the wisdom of the Perl Monks concerning the following question:

Dear Fellow Monks,

I'm wanting to create a TK widget that is a dropdown menu that contains a list of the letters of the currently mapped drives. Ie. So the list contains "C,D,E,F,H,P" etc.

Thanks


Dean
The Funkster of Mirth
Programming these days takes more than a lone avenger with a compiler. - sam
RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers

Comment on TK - dropbox with drive mappings
Re: TK - dropbox with drive mappings
by arden (Curate) on Apr 01, 2004 at 05:52 UTC
    Um, is there a question here?

    Creating a dropdown list is pretty straight-forward in Tk and knowing your past postings I'm sure you can competantly do that. If you're wanting a quick way to get the list of mapped drive letters on Windows, look at Win32::DriveInfo. It has that capability (and the inverse list too). It'll even let you determine if the drive is writeable, etcetera if you'd like that info too.

    - - arden.

Re[0]: TK - dropbox with drive mappings
by Intrepid (Deacon) on Apr 01, 2004 at 06:24 UTC

    I try not to downvote without giving explanation. So I am explaining why I am downvoting this node:

    • No mention given of what the poster knows or has tried to do so far
    • No specific point that s/he needs help with
    • It looks completely like a scurvy ploy to get other people to write the code completely for her/im.

      It seems the Win32::DriveInfo by arden is what I'm looking for. Thanks mate. The dropdown menu option still eludes me. Maybe I'm missing something obvious which is highly probable but I've looked. The code I can write myself, just need to know a useable module for win32. Anyone?

      Thanks for your feedback, I'll consider that next time I post. :-) Sorry for the short initial post with little history but I was racing to a meeting. I wasn't for laziness or lack of looking. Sometimes even the obvious can elude us.


      Dean
      The Funkster of Mirth
      Programming these days takes more than a lone avenger with a compiler. - sam
      RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers
        Try either one of Tk::Optionmenu, Tk::BrowseEntry, or just use a list of Buttons.
Re: TK - dropbox with drive mappings
by crabbdean (Pilgrim) on Apr 02, 2004 at 00:53 UTC
    Okay thanks arden and eserte for you help. Here is the solution:
    #!perl use Tk; use Tk::BrowseEntry; use Win32::DriveInfo; @drives = Win32::DriveInfo::DrivesInUse(); @drives = map ($_ . ":", @drives); @freelet = Win32::DriveInfo::FreeDriveLetters(); @freelet = map ($_ . ":", @freelet); $mw = new MainWindow; $d = $mw->BrowseEntry(-label => "Mapped Drives", -variable => \$var, -state => 'readonly', -choices => \@drives)->pack; $f = $mw->BrowseEntry(-label => "Free Drives", -variable => \$var1, -state => 'readonly', -choices => \@freelet)->pack; MainLoop;

    Dean
    The Funkster of Mirth
    Programming these days takes more than a lone avenger with a compiler. - sam
    RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://341515]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-04-20 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (489 votes), past polls