You used Perl to call an external JavaScript interpreter to call a scripting object that is not native to either.

I can get those same numbers from the underlying Win32 API using a couple of easy Perl modules. It's amazing what you can do in Perl without resorting to external executables calling external interpreters when you are willing to use a module or two.

# Recreate the JS in actual Perl with Win32-based modules, because the +re's no reason to spawn a javascript interpreter to run a ScriptingOb +ject library to do the underlying win32 api calls that they wrap use warnings; use strict; use Win32API::File (); # comes pre-installed with Strawberry +Perl use Win32::DriveInfo (); # installed using `cpanm Win32::DriveI +nfo` sub GetDriveInfoPL { my $drives = defined $_[0] ? $_[0] : join('', 'A'..'Z'); local $\ = "\n"; my $retval = "\nPerl Gets:\n"; for ( split //, $drives ) { my $drive = $_ . ':'; # GetDriveType is one of many ways to determine whether it's a +n active drive or not, with the benefit that it can distinguish betwe +en types of drives my $type = Win32API::File::GetDriveType($drive); next unless $type > Win32API::File::DRIVE_NO_ROOT_DIR; my $typestr = (qw/DRIVE_UNKNOWN DRIVE_NO_ROOT_DIR DRIVE_REMOVA +BLE DRIVE_FIXED DRIVE_REMOTE DRIVE_CDROM DRIVE_RAMDISK/)[$type]; #print "GetDriveType($drive) = $type => $typestr"; my $fsotype = $type - 1; # the FSO .DriveType is off-by-one fr +om the Win32API::File::GetDriveType() call: <https://learn.microsoft. +com/en-us/office/vba/language/reference/user-interface-help/drivetype +-property> # GetVolumeInformation grabs most of the attributes available +from the FSO Drive object properties warn "GetVolumeInformation($drive) failed: $^E\n" unless Win32 +API::File::GetVolumeInformation("${drive}/", my $osVolName, 99, my $o +uSerialNum, my $ouMaxNameLen, my $ouFsFlags, my $osFsType, 99 ); my $hexSerialNum = sprintf '%X', $ouSerialNum; #print "GetVolumeInformation(${drive}/) => $osVolName, $ouSeri +alNum = 0x$hexSerialNum, $ouMaxNameLen, $ouFsFlgs, $osFsType"; #... except size info, which can be gotten through Win32::Driv +eInfo my @space = Win32::DriveInfo::DriveSpace($drive); #print "DriveSpace($drive) = ", join ', ', @space; $retval .= "$drive*$fsotype*$hexSerialNum*$osFsType*$osVolName +*$space[5]*$space[6]\n"; } print $retval; } # GetDriveInfoJS(); # this is the GetDriveInfo sub from [harangsolt33] +'s answer (so not repeated here) GetDriveInfoPL();

and the results:

JS Gets: C:*2*BE093728*NTFS*OS*1001296752640*719091134464 J:*3*BBA13F0F*NTFS*MyNAS*2984210202624*2221555318784 T:*3*448F8317*exFAT*OffBrand Cloud Drive*54760833024*54619620864 Perl Gets: C:*2*BE093728*NTFS*OS*1001296752640*719091134464 J:*3*BBA13F0F*NTFS*MyNAS*2984210202624*2221555318784 T:*3*448F8317*exFAT*OffBrand Cloud Drive*54760833024*54619620864
(volume labels obfuscated)

In reply to Re^2: Almost cool: removable drive "finder" instead of windows autoplay by pryrt
in thread Almost cool: removable drive "finder" instead of windows autoplay by Intrepid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.