#SingleInstance, Force SetWorkingDir, %A_ScriptDir% SetBatchLines -1 IfNotExist, TheFontList.txt, UrlDownLoadToFile , http://www.autohotkey.net/~Skan/Utils/FontDL/TheFontList.txt,TheFontList.txt FileRead, FontList, TheFontList.txt Gui, Font, S10 Gui, Add, Button, y-25 w100 h25 Default gPreview, Preview Gui, Add, Edit, y+10 w460 h24 hWndhEdit -E0x200 cAA1010 Border vQuery gsTimer SendMessage, 0xD3, 0x1,5,, ahk_id %hEdit% Gui, Font, S10 Gui, Add, ListView, yp+23 R10 w460 -Multi -Hdr -E0x200 Border gMouseClick, Font|Img Gui, Add, Picture, h44 y+5 Border vPreview, Preview.gif Gui, Add, Button, w200 h25 vDL gDownloadFont, &Download Font LV_ModifyCol( 1, 375 ), LV_ModifyCol( 2,60 ), DllCall( "LoadLibrary", Str,"wininet.dll" ) DllCall( "LoadLibrary", Str,"shdocvw.dll" ), DllCall("ole32\CoInitialize", UInt,0 ) Gui, Show,, Font Downloader ( www.webpagepublicity.com ) FontSearch: Critical GuiControlGet, Query LV_Delete() If ( Query="" ) { Loop, Parse, FontList, `n, `r Img := SubStr( A_LoopField,1,(P:=InStr(A_LoopField,A_Space))-1 ) , Font := SubStr(A_LoopField,P+1), LV_Add( "", Font, Img ) Return } StringReplace, Query, Query, +, +, UseErrorLevel SearchItems := ErrorLevel+1 Loop, Parse, FontList, `n, `r { Data := A_LoopField, Result := 0 Loop, Parse, Query, + Result := InStr(Data,A_LoopField,0,6) ? Result+1 : Result If ( Result = SearchItems ) Img := SubStr( Data,1,(P:=InStr(Data,A_Space))-1 ), Font := SubStr(Data,P+1) , LV_Add( "",Font,Img ) } Return sTimer: SetTimer, FontSearch, -200 Return MouseClick: IfNotEqual, A_GuiEvent, DoubleClick, Return Preview: Critical Row := LV_GetNext( 0, "Focused" ) LV_GetText( Font, Row, 1 ), LV_GetText( Img, Row, 2 ) StringReplace, Font, Font, %A_Space%, % "%20", All Ch:=DllCall( "CharLowerA", Str,SubStr(Img,1,1),Str ), achr := ((Ch<>"a") ? "s" : "") dlp := "http://www.webpagepublicity.com/free-fonts/" Ch "/Free-Font" achr "-" img ".gif" url := "http://www.webpagepublicity.com/free-fonts/" Ch "/" font ".ttf" UpdatePreview: Critical UrlDownloadToFile, %dlp%, preview.gif If ! FileSize := HttpQueryContentLength( url ) Return VarSetCapacity( Formatted,16,0 ) DllCall( "shlwapi.dll\StrFormatByteSize64A", Int64,FileSize, Str,Formatted, UInt,16 ) GuiControl,, DL, Download Font ( %Formatted% ) GuiControl,, Preview, preview.gif Return DownloadFont: IfEqual,Url,,Return aL := StrLen( Url ) , uL := ( (aL*2)+2 ), VarSetCapacity( ucUrl, uL, 0 ) DllCall( "MultiByteToWideChar", UInt,0, UInt,0, Str,Url, Int,aL, UInt,&ucUrl, Int,uL ) DllCall("shdocvw.dll\DoFileDownload", Str, ucUrl ) Return GuiClose: GuiEscape: ExitApp HttpQueryContentLength( URL ) { ; Thx Olfen www.autohotkey.com/forum/viewtopic.php?t=10510 hIOU := DllCall( "wininet\InternetOpenUrlA", UInt , ( hIO := DllCall( "wininet\InternetOpenA", Str,N, UInt,1, Str,N, Str,N, UInt,0 ) ) , Str,URL, Str,N, UInt,0, UInt,0x80000000, UInt,0 ) If ErrorLevel || !hIOU Return -1 Loop % VarSetCapacity( CL,20,0 ) - 15 If Q:=DllCall( "wininet\HttpQueryInfoA", UInt,hIOU, Int,5, UInt,&CL, UIntP,Len, Int,0 ) Break DllCall( "wininet\InternetCloseHandle", UInt,hIO ) DllCall( "wininet\InternetCloseHandle", UInt,hIOU ) Return, Q ? DllCall( "MulDiv", Int,&CL, Int,1, Int,1, Str ) : -2 }