Installing fonts - template .wbt needed

Started by jimklein, October 14, 2013, 08:53:51 AM

Previous topic - Next topic

jimklein


I have a c:\fonts\... directory that I need to install fonts. (.ttf & .otf)

Does someone have a template "install fonts" script I can use ?

Thanks

kdmoyers

No, but it is my perception that if you use the shell extender function afilecopy to copy the files into the windows fonts folder, then windows will automatically "install" them.  is that true Deana?
The mind is everything; What you think, you become.

DirkM

I install fonts using this script

      objShell = CreateObject("Shell.Application")
      objFolder = objShell.Namespace(SourcePath)
      objFolderItem = objFolder.ParseName(FontFileName)
      colVerbs = objFolderItem.Verbs
      ForEach objVerb in colVerbs
         If StrIndexNC(objVerb.name,'&I',1,@FWDSCAN) != 0 || StrIndexNC(objVerb.name,'Install',1,@FWDSCAN) != 0
            objVerb.DoIt
            Break
          EndIf
      Next

Deana

Quote from: kdmoyers on October 15, 2013, 06:15:38 AM
No, but it is my perception that if you use the shell extender function afilecopy to copy the files into the windows fonts folder, then windows will automatically "install" them.  is that true Deana?
Not sure the Shell Op extender is even required. You might be able to simply use FileCopy to copy the files to C:\Windows\Fonts. However you are going to need administrative privileges.  As i understand it, once they are copied to C:\Windows\Fonts, applications will be able to find and use them.  You may need to Inform running apps about the new font using a sendmessage: IntControl(22,-1,29,0,0).

I found an old code sample that calls AddFontResource using DllCall: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/How~To+Install~a~font.txt.

Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

Quote from: DirkM on October 15, 2013, 07:51:47 AM
I install fonts using this script

      objShell = CreateObject("Shell.Application")
      objFolder = objShell.Namespace(SourcePath)
      objFolderItem = objFolder.ParseName(FontFileName)
      colVerbs = objFolderItem.Verbs
      ForEach objVerb in colVerbs
         If StrIndexNC(objVerb.name,'&I',1,@FWDSCAN) != 0 || StrIndexNC(objVerb.name,'Install',1,@FWDSCAN) != 0
            objVerb.DoIt
            Break
          EndIf
      Next

Nice Solution. I will add to the tech database.
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

Quote from: Deana on October 15, 2013, 09:28:01 AM
Quote from: kdmoyers on October 15, 2013, 06:15:38 AM
No, but it is my perception that if you use the shell extender function afilecopy to copy the files into the windows fonts folder, then windows will automatically "install" them.  is that true Deana?
Not sure the Shell Op extender is even required. You might be able to simply use FileCopy to copy the files to C:\Windows\Fonts. However you are going to need administrative privileges.  As i understand it, once they are copied to C:\Windows\Fonts, applications will be able to find and use them.  You may need to Inform running apps about the new font using a sendmessage: IntControl(22,-1,29,0,0).

I found an old code sample that calls AddFontResource using DllCall: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/How~To+Install~a~font.txt.

It appears that copying the file using FileCopy to the Windows Font directory is not sufficient on Windows 7:  http://blogs.technet.com/b/rspitz/archive/2010/09/25/how-to-install-a-font-from-the-command-line-on-windows-7.aspx
Deana F.
Technical Support
Wilson WindowWare Inc.