Page 1 of 2 12>
Topic Options
#74579 - 2003-04-17 05:27 PM Adding a Font
SMeggs Offline
Fresh Scripter

Registered: 2003-04-17
Posts: 5
Loc: London UK
I am trying to add a new Font to Windows 2000 Profesional SP3 clients.

I used to use

copy @lserver + "\netlogon\*.ttf" "c:\winnt\fonts"
writevalue( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" , "Eni 1 (TrueType)" , "Eni1____.ttf" , "REG_SZ")
writevalue( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" , "Eni 2 (TrueType)" , "Eni2____.ttf" , "REG_SZ")
writevalue( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" , "Eni 3 (TrueType)" , "Eni3____.ttf" , "REG_SZ")

But it has now stopped working. The fonts are copied and shown in both the directory and Control panel Fonts screen. However no Application can use them.

Any idea's why this has stopped working ?

All clients have local admin privs.

Its as if something else needs to be kicked to validate the Fonts.

Top
#74580 - 2003-04-18 05:51 AM Re: Adding a Font
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
SMeggs,

Welcome to the board!

I thought adding a new font was a simple matter of copying a .FOT or .TTF file to -

%WINDIR%\Fonts

You can then do an IF EXIST.. to check for it.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74581 - 2003-04-18 07:23 AM Re: Adding a Font
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Actually from what I can remember, copying via DOS does not alert Windows that a new file has been copied there.

Maybe try the GUICOPY UDF and see how that works.

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000245

Top
#74582 - 2003-04-18 07:56 AM Re: Adding a Font
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
On Wintendos I do this to update fonts, which works fine:

code:
$KeyFonts = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Fonts"
$Fontdir = "i:\arr.alg\sysbeh\install\fonts\" ; Systeembeheerder kan dit aanpassen aan zijn netwerkomgeving
$Font1 = $Fontdir + "beatrix.*"
$Font2 = $Fontdir + "bert*.*"
$Font3 = $Fontdir + "uto*.*"


;########## FONTS ####################################################################################################

; Variablen vaststellen
; Fonts voor de huisstijl uit de registry van Windows verwijderen
$RC = DelValue($KeyFonts, "Beatrix (TrueType)")
$RC = DelValue($KeyFonts, "Berthold Imago Light (TrueType)")
$RC = DelValue($KeyFonts, "Berthold Imago Light Italic (TrueType)")
$RC = DelValue($KeyFonts, "Berthold Imago Medium (TrueType)")
$RC = DelValue($KeyFonts, "Utopia (TrueType)")
$RC = DelValue($KeyFonts, "Utopia Bold (TrueType)")
$RC = DelValue($KeyFonts, "Utopia Italic (TrueType)")
$RC = DelValue($KeyFonts, "Utopia SB Semi Bold (TrueType)")

$RC = SetFileAttr("c:\windows\fonts\beatrix.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\bertli.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\bertliit.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\bertme.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\utopbo.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\utopit.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\utopme.ttf",32)
$RC = SetFileAttr("c:\windows\fonts\utopsbo.ttf",32)
Del "%windir%\fonts\beatrix.*"
Del "%windir%\fonts\bert*.*"
Del "%windir%\fonts\uto*.*"

Copy $Font1 "%windir%\fonts\" /h
Copy $Font2 "%windir%\fonts\" /h
Copy $Font3 "%windir%\fonts\" /h

$RC = WriteValue($KeyFonts, "Beatrix (TrueType)", "beatrix.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Berthold Imago Light (TrueType)", "bertli.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Berthold Imago Light Italic (TrueType)", "bertme.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Berthold Imago Medium (TrueType)", "bertliit.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Utopia (TrueType)", "utopme_E.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Utopia Bold (TrueType)", "utopbo_E.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Utopia Italic (TrueType)", "utopit_E.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Utopia SB Semi Bold (TrueType)", "utopsboE.ttf", "Reg_SZ")
$RC = WriteValue($KeyFonts, "Utopia Expert (TrueType)", "Utoexp_E.ttf", "Reg_SZ")

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#74583 - 2003-04-18 08:06 AM Re: Adding a Font
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Hmmm seems the same doesn't it??

Got a Q for you:
Is the script started with ADMIN powers?

If not, it will not work since normal users may not write in HKLM...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#74584 - 2003-04-18 01:55 PM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
updating a font is different as it's been already installed by system so it only is about updating the files.
_________________________
!

download KiXnet

Top
#74585 - 2003-04-18 02:32 PM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, think I found a way to do this pretty easily...

just need some more fonts to test first...
_________________________
!

download KiXnet

Top
#74586 - 2003-04-18 02:37 PM Re: Adding a Font
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
My script should work for install too.

Problem I think is writing in HKLM...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#74587 - 2003-04-18 03:05 PM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
whatever, this works for all...



function InstallFont($source)
dim $,$Shell
 $Shell = CreateObject("Shell.Application")
 $Shell.NameSpace(20).CopyHere($source4)
 $Shell.open(20)
 do $=setfocus("Fonts"until @error=0 $=sendkeys("~{F4}")
endfunction



anyway, you should remember that I didn't make it force nor hide GUI if error occurs.
thus, if you are updating fonts, remove the old files first.
oh, supports wildcarts [Big Grin]
_________________________
!

download KiXnet

Top
#74588 - 2003-04-18 03:07 PM Re: Adding a Font
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Q again, what about required admin powers???
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#74589 - 2003-04-18 03:10 PM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no need for admin [Big Grin]
it's enough to have poweruser rights [Razz]

anyway, Q to your Q, what part of system you can install without correct rights?
_________________________
!

download KiXnet

Top
#74590 - 2003-04-18 03:11 PM Re: Adding a Font
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
delpart.exe???
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#74591 - 2003-04-18 08:55 PM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now as I think of it, someone else could try to go around the sendkey part with some IE-com code...

make it browse to fonts-dir and show and hide right after.
that should trigger the shell-installer.
_________________________
!

download KiXnet

Top
#74592 - 2003-04-24 12:41 AM Re: Adding a Font
SMeggs Offline
Fresh Scripter

Registered: 2003-04-17
Posts: 5
Loc: London UK
First I would like to thank you all for the number of replies.

LONKERO

Your function call looks very interesting.
Could you please expand on your information, i.e. what exact code I could use from my original posting and how do I call and return from the function.
I have to apologise as I am not a programmer and a little more help is required.

Many thanks

Steve

Top
#74593 - 2003-04-23 06:28 PM Re: Adding a Font
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please read the FAQ Forum, especially How to use UDFs . You provide the source of the font file. Tee UDF will then copy it into the appropriate directory.

[ 24. April 2003, 01:39: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#74594 - 2003-04-24 01:36 AM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
OK!
did some research and vóila!
this UDF does not need sendkeys!

didadaa!



function InstallFont($source)
dim $Window,$Shell
 $Shell = CreateObject("Shell.Application")
 $Shell.NameSpace(20).CopyHere($source,4)
 $Window = createobject("internetexplorer.application")
 $Window.navigate2(20)
 $Window.visible = not 0
 $Window.quit
endfunction

_________________________
!

download KiXnet

Top
#74595 - 2003-04-24 01:41 AM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now looking at your code.
you need nothing from it.

just add this UDF code of mine to somewhere in your script and call it (wherever inside the same script):

installfont("c:\myfonts\*.ttf")

and all truetype fonts from your myfonts folders would be installed [Big Grin]

easy?
it's full pack-go-and-brush-your-teeth-code.
nothing for you to add or modify.
_________________________
!

download KiXnet

Top
#74596 - 2003-04-24 11:50 AM Re: Adding a Font
SMeggs Offline
Fresh Scripter

Registered: 2003-04-17
Posts: 5
Loc: London UK
Sorry to be a pain but when I add any function call i.e.
function InstallFont($source)
+code .....
I get an error message from Kixtart
"Script ERROR : unknown command.! Function InstallFont($source)"
I get the same if I try to use the GUIcopy function call. It appears to make no difference where I place the function statements.

What stupid thing have I got wrong this time ??

Doh
Steve

Top
#74597 - 2003-04-24 11:54 AM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
check out:
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000394

all you need to do (like said before) is to add the whole code from the start to the end (endfunction) to somewhere in your script.
normally at the end.

when you call udf, you do it like any normal kixtart command function.

simply saying in your script:
installfont("myfontpath")

will do.
_________________________
!

download KiXnet

Top
#74598 - 2003-04-24 11:58 AM Re: Adding a Font
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now as I think of it.
be sure that you have kixtart 4.00 or above.
the oldies do not support user defined functions!
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.113 seconds in which 0.065 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org