in reply to Enumerate Win32 Fonts

WMI is good for this kind of work
use strict; use Win32::OLE('in'); my $computer = "my_pc"; #your computer name as it appears in the cont +rol panel's system menu my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\roo +t\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_FontInfo +Action", "WQL"); foreach my $objItem (in $colItems) { print "Caption: $objItem->{Caption}\n"; print "FontTitle: $objItem->{FontTitle}\n"; print "File: $objItem->{File}\n"; print "\n"; } }
also,there are other properties of Win32_FontInfoAction class that can be queried eg description,file,version. You can use constants wbemFlagReturnImmediately and wbemFlagForwardOnly opting for faster execution. Creating Faster Queries by Using a Forward-only Eumerator

Replies are listed 'Best First'.
Re^2: Enumerate Win32 Fonts
by slloyd (Hermit) on Jan 22, 2008 at 15:57 UTC
    When I run your code it hangs on the foreach. I am not sure why.

    -------------------------------
    Need a good Perl friendly Host Provider?
    http://www.dreamhost.com

      give it some time,it may appear like it's hanging.if it reaches beyond 'die "WMI connection failed";' should be fine.
      It runs a 'select *' query so it will take some time.Subsequent calls will be faster.