+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
Scripts Thread, Script To Install Fonts To Workstations in Coding and Web Development; If you are looking for an easy way to intall fonts in windows 7 with a little script. you can ...
  1. #16

    Join Date
    Aug 2011
    Location
    Bern
    Posts
    4
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Install font with a script that works in windows 7

    If you are looking for an easy way to intall fonts in windows 7 with a little script.

    you can find it for free on our page:


    Cheers

  2. #17

    Join Date
    Aug 2011
    Location
    Bern
    Posts
    4
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

  3. Thanks to maximator152 from:

    zachariah (30th January 2012)

  4. #18

    Join Date
    May 2011
    Posts
    16
    Thank Post
    11
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Excellent script from maximator152 there - thanks!

    Also, here is a page with easy details to quickly make an msi for one or more fonts:

    laslow.net/2009/02/23/installing-a-font-via-gpo-server-20032008/

    (you'll need to have a copy of WininstallerLE, which I think is still free)

    I've used that method with no problems so far. The only slight inconvenience is the machines need a restart after the msi has run before the font is visible to the user.

  5. #19

    Join Date
    Feb 2012
    Location
    Santo Domingo
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by srochford View Post
    Add in some debugging:
    Code:
    Sub InstallFonts
      on error resume next
      Const FONTS = &H14
      dim , oFSO,oShell, oFolder1, oFolder2, sRoot
      sRoot="\\server\share\fonts\"
      Set oShell = CreateObject("Shell.Application")
      set oFSO=createobject("scripting.filesystemobject")
    
    set oLog=ofso.createtextfile("c:\windows\temp\fonts.log",true)
    
      Set oFolder1 = oShell.Namespace(FONTS)
      set oFolder2=ofso.getfolder(sRoot)
      for each oFile in oFolder2.files
        sName=lcase(oFile.name)
    
    oLog.writeLine "found: " & sName
    
        if right(sName,4)=".ttf" then
          if not ofso.fileexists(oFolder1.self.path & "\" & sName) then
    
    oLog.writeLine "installing: " & sName
    
            oFolder1.copyhere sRoot & sName
          end if
        end if
      next
      on error goto 0
    
    oLog.close
    
    End Sub
    - add the "olog" lines and it should write a log file to c:\windows\temp\fonts.log with some info about what's happening.
    If that file doesn't get created then the script just isn't running. If it gets created and it appears to not find any fonts then your script isn't able to read the fonts directory (remember you must have "domain computers" with read access to get that to work)
    This script didn't work for me, when I double click it present an error in line4.

    This is what I have in line 4 sRoot="c:\font\c39hrp24dhtt.ttf" just to my localdisk.
    And there's no font.log in windows\temp to see what's happening.

    any Ideas?

  6. #20

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    I've used fontreg for this in the past, have just put it in some package folder alongside the font files and run: fontreg /copy
    Last edited by PiqueABoo; 19th February 2012 at 03:42 PM.

  7. 2 Thanks to PiqueABoo:

    iom100 (30th October 2013), TechSupp (20th February 2012)

  8. #21
    quietriot1983's Avatar
    Join Date
    Dec 2010
    Location
    Manchester
    Posts
    105
    Thank Post
    15
    Thanked 6 Times in 6 Posts
    Rep Power
    10
    Quote Originally Posted by srochford View Post
    Copying the fonts and writing the registry keys will work but sometimes seems to need a restart of Explorer (so if you run this at startup then the fonts will be there the next time the machine starts).

    The link from @chrish looks fine but it looks like hard work :-)

    MS provide scripting support for installing fonts - the code I've used is below. Basically, put any fonts you want installing in a server folder (\\server\share\fonts in the example) and then call this code as an extra sub-routine in your machine startup script.

    If you ever want to add a new font, just copy it to the server; next time the machines reboot they'll install it.

    Code:
    Sub InstallFonts
      on error resume next
      Const FONTS = &H14
      dim , oFSO,oShell, oFolder1, oFolder2, sRoot
      sRoot="\\server\share\fonts\"
      Set oShell = CreateObject("Shell.Application")
      set oFSO=createobject("scripting.filesystemobject")
      Set oFolder1 = oShell.Namespace(FONTS)
      set oFolder2=ofso.getfolder(sRoot)
      for each oFile in oFolder2.files
        sName=lcase(oFile.name)
        if right(sName,4)=".ttf" then
          if not ofso.fileexists(oFolder1.self.path & "\" & sName) then
            oFolder1.copyhere sRoot & sName
          end if
        end if
      next
      on error goto 0
    End Sub

    When I run this, I get an "Expected Identifier" error, any ideas?

  9. #22
    ass17's Avatar
    Join Date
    Feb 2013
    Posts
    360
    Thank Post
    5
    Thanked 40 Times in 37 Posts
    Rep Power
    27
    I will post my script later.....

  10. #23

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,613
    Thank Post
    746
    Thanked 1,706 Times in 1,519 Posts
    Rep Power
    437
    Wow good old info this thread was started in 2006.

    Ben

  11. #24
    thesk8rjesus's Avatar
    Join Date
    Sep 2008
    Posts
    107
    Thank Post
    11
    Thanked 6 Times in 6 Posts
    Rep Power
    14

    Post

    Here is the script that I wrote the other day. It looks in a server folder for font files and installs them. It also checks if the font is already installed and then skips over it if it is, and then adds into the event log that the font was installed. We use this as a package on SCCM and push it out when we approve new fonts.

    Code:
    Const FONTS = &H14& 
    
    'defining variables
    Dim FSO, fontPath, objShell, objFolder, wshShell, winDir
    
    'setting variables
    Set FSO = CreateObject( "Scripting.FileSystemObject" )
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    Set wshShell = WScript.CreateObject( "WScript.Shell" )
    
    'setting strings
    fontPath = "\\servername\Fonts\"	'Change this folder path to font folder
    winDir = wshShell.ExpandEnvironmentStrings( "%windir%" )
    
    For Each font In FSO.GetFolder( fontPath ).Files
    	If( FSO.FileExists( winDir & "\fonts\" & FSO.GetFileName( font ) ) ) Then
    		'do nothing
    	Else
    		'checking if file is a font
    		If inStr( LCase( FSO.GetFileName( font ) ), "ttf" ) Or _
    			inStr( LCase( FSO.GetFileName( font ) ), "otf" ) Or _
    			inStr( LCase( FSO.GetFileName( font ) ), "fon" ) Then
    				'Installing font
    				objFolder.CopyHere fontPath & FSO.GetFileName( font ), &H14&
    				
    				'Add event to event viewer
    				wshShell.LogEvent 4, "The " & FSO.GetFileName( font ) & " font has been installed."
    		End If
    	End If
    Next

  12. Thanks to thesk8rjesus from:

    NewFormz (5th August 2013)

  13. #25
    old_n07's Avatar
    Join Date
    Jun 2012
    Location
    North Staffordshire
    Posts
    99
    Thank Post
    10
    Thanked 17 Times in 15 Posts
    Rep Power
    7
    We use PowerShell to install fonts, this is the code

    Code:
     $path = "<path to font>\<font name>.ttf"
     $sa =  new-object -comobject shell.application
     $Fonts =  $sa.NameSpace(0x14)
     $Fonts.copyhere($path)

  14. Thanks to old_n07 from:

    NewFormz (5th August 2013)



SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 18
    Last Post: 12th September 2013, 06:44 PM
  2. Installing/Copying Fonts from Login Script
    By mattpant in forum Windows
    Replies: 10
    Last Post: 11th August 2011, 10:24 PM
  3. Deploying Fonts
    By HodgeHi in forum Wireless Networks
    Replies: 7
    Last Post: 22nd April 2008, 12:10 PM
  4. Missing fonts in Publisher 2003
    By Kyle in forum Windows
    Replies: 1
    Last Post: 17th October 2007, 11:05 AM
  5. Help with Fonts
    By Mr_M_Cox in forum Windows
    Replies: 6
    Last Post: 10th September 2007, 12:17 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •