+ Post New Thread
Results 1 to 9 of 9
Windows 7 Thread, Windows 7 fonts Installing nightmare in Technical; RIGHTT!!!! I have spent about 2.5 hours this afternoon working on trying to install fonts automatically in Windows 7 from ...
  1. #1

    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    226
    Thank Post
    22
    Thanked 9 Times in 9 Posts
    Rep Power
    13

    Windows 7 fonts Installing nightmare

    RIGHTT!!!!

    I have spent about 2.5 hours this afternoon working on trying to install fonts automatically in Windows 7 from a script!

    So far, I have come up with a basic script that installs the script fine at startup, but it can't seem to check in anyway, whether the font already exists....

    Can anyone give me some help with my script - its a vbscript, as below:

    Code:
    ' Fonts.installer
    ' ----------------------------------------------------------
    Option Explicit
    
    Dim objShell, objFolder
    
    Const FONTS = &H14&
    
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    objFolder.CopyHere "\\%server%\%sharename%\!Y2KBUG.ttf"
    
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    objFolder.CopyHere "\\%server%\%sharename%\$FIVEDOU.ttf"
    
    Wscript.Quit
    I don't know if it is something special to do with the Windows/Fonts directory in Windows 7, but nothing I do, can seem to check the exisitance of a font already in the directory....

    Can anyone help!

    Cheers
    _techie_

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by _techie_ View Post
    So far, I have come up with a basic script that installs the script fine at startup, but it can't seem to check in anyway, whether the font already exists....

    Can anyone give me some help with my script - its a vbscript, as below:
    Can you show the code you're trying to use to check if they exist? Easier to see if something's wrong if you post it

    Steve

  3. #3

    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    226
    Thank Post
    22
    Thanked 9 Times in 9 Posts
    Rep Power
    13
    I have posted the code in my previous post.

    ^^^ Cheers
    _techie_

  4. #4

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by _techie_ View Post
    I have posted the code in my previous post.

    ^^^ Cheers
    _techie_
    Well you haven't checked if files exist at all... Nor do you have any variables etc etc :P

    So did you try to check it, or prefer just full version posted? :P Don't mind either way

    Try this:

    Code:
    On error resume next
    dim fontlist(3),root,path,check,filelist
    fontlist(0)="font1.TTF"
    fontlist(1)="font2.TTF"
    fontlist(2)="font3.TTF"
    fontlist(3)="font4.TTF"
    
    Set fso = CreateObject("Scripting.FileSystemObject") 
    filepath = fso.GetParentFolderName(wscript.ScriptFullName)
    
    set wshShell = Wscript.CreateObject("Wscript.shell")
    fontpath = wshShell.ExpandEnvironmentStrings("%windir%")
    
    Const FONTS = &H14&
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    
    for each font in fontlist
    	copyto=filepath+"\"+font
    	check_file=fontpath+"\fonts\"+font
    	if fso.FileExists(check_file) then
    		root=0
    	else
    		objFolder.CopyHere copyto
    	end if
    next
    Steve

  5. #5


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,878
    Thank Post
    226
    Thanked 2,669 Times in 1,968 Posts
    Rep Power
    786

  6. #6

    ZeroHour's Avatar
    Join Date
    Dec 2005
    Location
    Edinburgh, Scotland
    Posts
    5,670
    Thank Post
    904
    Thanked 1,318 Times in 800 Posts
    Blog Entries
    1
    Rep Power
    445
    Here is a script that works.
    Code:
    Const FONTS = &H14&
    
    Dim wsh
    Set wsh = WScript.CreateObject("Wscript.Shell")
    
    function LogtoEvent (MSG,success)
    	select case success
    		case 1	wsh.LogEvent EVENT_SUCCESS, MSG ' 1 is a success
    		case 0	wsh.LogEvent EVENT_FAILURE, MSG ' 0 is a error
    		case 2	wsh.LogEvent EVENT_WARNING, MSG ' 2 is a warning
    		case 3	wsh.LogEvent EVENT_INFORMATION, MSG ' do not use
    	end select
    end function
    LogtoEvent "INSTALL FONTS: Started Installing Fonts",1
    
    strSource = "\\{UNC PATH TO DIR WITH FONTS}"
    arrFiles = Array("{FONT NAME.ttf", "{ANOTHER FONT NAME.ttf}")
     
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
     
    For Each strFile in arrFiles
        Set objFolderItem = objFolder.ParseName(strFile)
        
        If objFolderItem is nothing Then
        	LogtoEvent "INSTALL FONTS: Installing " & strFile,1
            objFolder.CopyHere strSource & "\" & strFile, &H4&
        End If
    Next
    
    LogtoEvent "INSTALL FONTS: Done",1
    This leaves entries in the event log too ftw

  7. #7

    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    226
    Thank Post
    22
    Thanked 9 Times in 9 Posts
    Rep Power
    13
    in answer to steve21

    well..I ran a BAT file with the following:

    @echo OFF
    IF EXIST "C:\WINDOWS\Fonts\!Y2KBUG.ttf" GOTO END
    wscript.exe "C:\font_installer.vbs"
    :End
    ECHO Font installed correctly

    However...this just went straight to End immediately!
    If I just run the wscript.exe part it installs the fonts fine, but just repeats the issue everytime the bat file runs :-(

  8. #8


    Join Date
    Mar 2009
    Location
    Leeds
    Posts
    6,588
    Thank Post
    228
    Thanked 856 Times in 735 Posts
    Rep Power
    296
    i just used winstall and made an msi that has worked for me in he past if i needed to get fonts to a win7 box

  9. #9
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,488
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Quote Originally Posted by ZeroHour View Post
    Here is a script that works.
    So I should save that as a .vbs and stick it in NetLogon, yes?

SHARE:
+ Post New Thread

Similar Threads

  1. Installing/Copying Fonts from Login Script
    By mattpant in forum Windows
    Replies: 10
    Last Post: 11th August 2011, 09:24 PM
  2. Replies: 0
    Last Post: 19th May 2011, 11:42 AM
  3. Installing Fonts
    By RabbieBurns in forum Windows 7
    Replies: 2
    Last Post: 28th May 2010, 03:07 PM
  4. Installing Fonts
    By enjay in forum How do you do....it?
    Replies: 10
    Last Post: 11th September 2009, 01:51 PM
  5. Visual Studio 6 on XP : Nightmare installing!
    By googlemad in forum Windows
    Replies: 2
    Last Post: 22nd October 2007, 01:05 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
  •