MrMatt
(Lurker)
2002-02-06 05:53 PM
Font register

Hi,

I want to write a script that will deliver and register a font to workstations, without re-booting the machine. The syntax I'm using is: COPY "./HBOS.ttf" "c:\winnt\system32\HBOS.ttf"

WRITEVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts","HBOS (TrueType)","HBOS.ttf", REG_SZ)

However the machine then needs to be rebooted before the font is available in Word etc.

Can this be done without re-booting?

Kdyer
(KiX Supporter)
2002-02-06 10:50 PM
Re: Font register

MrMatt,

Why aren't you doing the following?

code:

COPY "./HBOS.ttf" "%windir%\fonts\HBOS.ttf"

I believe (of course I could be wrong) once you copy to this "magical" folder, the system auto-registers the font(s) for you.

HTH,

- Kent

singk
(Fresh Scripter)
2003-05-28 04:51 PM
Re: Font register

I have a code below that worked on Win2k, but it doesn't work on WinXP. I know it's not the permission issues because the copy statement worked and I'm logon as Domain Administrator.

code:
      ; Check if DURA font installed
$Font=ReadValue($HKLMS + "Microsoft\Windows NT\CurrentVersion\Fonts","Dura (TrueType)")
If @ERROR <> 0
COPY $LogonDrv + "\GOR\BIN\dura____.ttf" "%WINDIR%\FONTS"
$Nul=WriteValue($HKLMS + "Microsoft NT\Windows\CurrentVersion\Fonts","Dura (TrueType)","dura____.ttf","REG_SZ")
EndIf

The code ran without any error. The writevalue statement also return zero, so it proves that there's no error, but somehow this key never get added. I also check to see if dura_____.ttf copied to %windir%\fonts, and it did.

Can someone help, please?

Thanks
Singk


Sealeopard
(KiX Master)
2003-05-28 05:18 PM
Re: Font register

Try the InstallFont() - Install Font(s) UDF from the UDF Forum.

singk
(Fresh Scripter)
2003-05-28 07:42 PM
Re: Font register

OOPS, I found what was the problem with my code. I somehow write to a wrong key. It must got change when I modified for Windows XP.

BAD coding:
code:
       ; Check if DURA font installed
$Font=ReadValue($HKLMS + "Microsoft\Windows NT\CurrentVersion\Fonts","Dura (TrueType)")
If @ERROR <> 0 COPY $LogonDrv + "\GOR\BIN\dura____.ttf" "%WINDIR%\FONTS"
$Nul=WriteValue($HKLMS + "Microsoft NT\Windows\CurrentVersion\Fonts","Dura (TrueType)","dura____.ttf","REG_SZ")
EndIf

Here's the CORRECT coding:
code:
       ; Check if DURA font installed
$Font=ReadValue($HKLMS + "Microsoft\Windows NT\CurrentVersion\Fonts","Dura (TrueType)")
If @ERROR <> 0 COPY $LogonDrv + "\GOR\BIN\dura____.ttf" "%WINDIR%\FONTS"
$Nul=WriteValue($HKLMS + "Microsoft\Windows NT\CurrentVersion\Fonts","Dura (TrueType)","dura____.ttf","REG_SZ")
EndIf

Also, I could use InstallFont() by Lonkero, but since I have only one font to be added, I will use the code above because it's simpler.

Thanks,
Singk


Sealeopard
(KiX Master)
2003-05-28 07:48 PM
Re: Font register

HKEY_LOCAL_MACHINE requires administrative privileges under Windows NT/2000/XP/2003

LonkeroAdministrator
(KiX Master Guru)
2003-05-28 09:00 PM
Re: Font register

singk, dunno what is simple.
if you use udf's in your logonscripts you soon realize that they are darn simple.

they are just kinda extensions to the default kixtart-language.
just like in programming languages [Wink]

once you get a hang of it, you won't stop loving them.