Jump to content

obtain windowsfonts list


 Share

Recommended Posts

hello,

ask help 'cause i'm going mad :P

very difficult to obtain my PC fonts list in 'exstended' format :

ariblk.ttf -> 'Arial Black (True Type)'

I'm interested on 'second' name.

Is possible to obtain these information ?

thank you for any info,

m.

Link to comment
Share on other sites

hello again find some post with similar question...

near one is this, 2 ways are exposed to obtain font list.

one registry based, one autoit code based.

now i'm search code for registry one. Find in this registry key both list:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts

is possible to read from registry right one ? ('long' name)

thank you,

m.

Edited by myspacee
Link to comment
Share on other sites

hello again find some post with similar question...

near one is this, 2 ways are exposed to obtain font list.

one registry based, one autoit code based.

now i'm search code for registry one. Find in this registry key both list:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts

is possible to read from registry right one ? ('long' name)

thank you,

m.

The registry is basically the route I had to resort to as well. I was originally hoping to get the data from a WMI query, but the Win32_FontInfoAction, though it contains a "Font Title" parameter, never gave any data results (the only fields with data returned were "ActionID" and "File" for each).

Here's a method to snag the list from the registry (AutoIt v3.2.10.0):

#include <Array.au3>
Dim $aFonts[1] = ["0"]
$sRegRoot = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"

$i = 1
Do
    $var = RegEnumVal($sRegRoot, $i)
    If Not @error Then
        $iIndex = $aFonts[0] +1
        ReDim $aFonts[$iIndex + 1]
        $aFonts[0] = $iIndex
        $aFonts[$iIndex] = $var
    EndIf
    $i += 1
Until @error

_ArraySort($aFonts,0,1)

_ArrayDisplay($aFonts)

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

works perfectly,

ehm can you give me another hint ?

i obtain :

[4]|Arial (TrueType)
[5]|Arial Black (TrueType)
[6]|Arial Bold (TrueType)
[7]|Arial Bold Italic (TrueType)
[8]|Arial Italic (TrueType)
[9]|Arial Narrow (TrueType)
...

how a can split row and delete text between (*random_text*), to obtain ONLY font name ?

Try _StringBetween and StringRegExp with no luck...

Thank you all for support !

m.

Link to comment
Share on other sites

Solved,

i've already ask similar thing.

Correct code, now fully works ! :P

#include <GuiConstantsEx.au3>
#include <String.au3>
#include <Array.au3>


Dim $aFonts[1] = ["0"]
dim $searchstring[1]
;///////////////////////////////////////////////////
;/  create array with fonts list
;///////////////////////////////////////////////////
$sRegRoot = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"

$i = 1
Do
    $var = RegEnumVal($sRegRoot, $i)
    If Not @error Then
        $iIndex = $aFonts[0] + 1
        ReDim $aFonts[$iIndex + 1]
        $aFonts[0] = $iIndex
        $aFonts[$iIndex] = $var
    EndIf
    $i += 1
Until @error



;///////////////////////////////////////////////////
;/  order in array - create html file
;///////////////////////////////////////////////////
_ArraySort($aFonts,0,1)
$file = FileOpen("yourfonts.html", 10); which is similar to 2 + 8 (erase + create dir)

;head of html file
FileWriteLine($file, "</body>" & @CRLF)
FileWriteLine($file, "</html>" & @CRLF)
FileWriteLine($file, "<html>" & @CRLF)
FileWriteLine($file, "<head>" & @CRLF)
FileWriteLine($file, "<title>Untitled Document</title>" & @CRLF)
FileWriteLine($file, "<meta http-equiv=" & chr(34) & "Content-Type" & chr(34) & "content=" & chr(34) & "text/html; charset=iso-8859-1" & chr(34) & ">" & @CRLF)
FileWriteLine($file, "</head>" & @CRLF)
FileWriteLine($file, "" & @CRLF)
FileWriteLine($file, "<body bgcolor=" & chr(34) & "#FFFFFF" & chr(34) & ">" & @CRLF)
FileWriteLine($file, "<p>" & @CRLF)


;////////////////////////////////////////////////////
;/ cicle trought list - clean font names - build html
;////////////////////////////////////////////////////
$i = 1
Do
    if $i > _ArrayMaxIndex($aFonts, 0, 1) Then
        msgbox(0,"",_ArraymaxIndex($aFonts))
        exitloop
    EndIf
    
    If Not @error Then

        $clean_font = _StringReplaceBetween($aFonts[$i], "(", ")", "")
        $clean_font = stringreplace($clean_font, "(", "")
        $clean_font = stringreplace($clean_font, ")", "")
        $clean_font = StringStripWS($clean_font,3)

        FileWriteLine($file, "<font face=" & chr(34) & $clean_font & chr(34) & ">" & stringleft($clean_font & "____________________", 30) & " - The quick brown fox jumps over the lazy dog</font><br>" & @CRLF)
        
    EndIf
    $i += 1
Until @error

;close html file
FileWriteLine($file, "</body>" & @CRLF)
FileWriteLine($file, "</html>" & @CRLF)




;///////////////////////////////////////////////////
;/  functions
;///////////////////////////////////////////////////

Func _StringReplaceBetween ($sString, $sStart, $sEnd, $sReplace)
    dim $searchstring[1]
    $searchstring = _StringBetween ($sString, $sStart, $sEnd)
    If @error Then SetError (1, -1, 0)
    $return = StringReplace ($sString, $searchstring[0], $sReplace)
    Return $return
EndFunc
Edited by myspacee
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...