Jump to content

Install fonts on windows 2000


Gyzmok
 Share

Recommended Posts

Hi all,

I am still a newbie in autoit, but i like it a lot.

In a script i try to install some new fonts into windows 2000 proffesional.

But it does not seem to work properly.

First i logged in as administrator and tried the following :

FileCopy("D:\temp\*.fon",@WindowsDir & "\fonts",1)
FileCopy("D:\temp\*.ttf",@WindowsDir & "\fonts",1)

But when i checked in C:\WINNT\fonts i saw the .TTF files with 0kb size.

Obviously, the fonts did not install properly. :idiot:

Can someone please help me out ?

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
Link to comment
Share on other sites

$sFileName is just an example...

$sFileName = 'C:\GAGGERS_.TTF';list separed by | (pipes) of .ttf files.
$a = DllCall('gdi32','long',"AddFontResourceA",'String',$sFilename)

$a[0] is the number of installed fonts, in case of errors it will be 0.

A good fonts site

http://www.fontflood.com/

Edit:

This dllcall does not copy the file in the fonts folder. So I guess it is a good idea copying manually and then call it.

Edited by ezzetabi
Link to comment
Share on other sites

  • Developers

But when i checked in C:\WINNT\fonts i saw the .TTF files with 0kb size.

Obviously, the fonts did not install properly.  :idiot:

Can someone please help me out ?

<{POST_SNAPBACK}>

Try:

FileCopy("D:\temp\*.fon",@WindowsDir & "\fonts\",1)
FileCopy("D:\temp\*.ttf",@WindowsDir & "\fonts\",1)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Fixed version.

$sFileName = 'C:\GAGGERS_.TTF'
If FileMove($sFileName, @WindowsDir & '\Fonts',1) Then
   $sFileName = @WindowsDir & '\Fonts\' & StringTrimLeft($sFileName, StringInStr($sFileName, '\', 0, -1))
   DllCall('gdi32', 'long', "AddFontResourceA", 'String', $sFileName)
EndIf

Just tested, it works.

Jdeb, just copying the files often gives problems. It is a good idea installing fonts using the dllcall or the standard windows GUI that you can access in the windows\fonts folder File menu.

Edited by ezzetabi
Link to comment
Share on other sites

just copying the files often gives problems. It is a good idea installing fonts using the dllcall or the standard windows GUI that you can access in the windows\fonts folder File menu.

Is there a api call to delete an existing font? I've ran into problems installing a ATM font over an existing older one.

Link to comment
Share on other sites

Easy as a cake:

$sFileName = @WindowsDir & '\fonts\GAGGERS_.TTF'
$a = DllCall('gdi32','long',"RemoveFontResourceA",'String',$sFilename)
If not @error and $a[0] <> 0 Then
   FileDelete($sFileName)
EndIf

$a[0] will be <> 0 if everything goes allright.

Link to comment
Share on other sites

  • Developers

Jdeb, just copying the files often gives problems. It is a good idea installing fonts using the dllcall or the standard windows GUI that you can access in the windows\fonts folder File menu.

<{POST_SNAPBACK}>

just indicated that the backslash was missing at the end of the Target parameter.

You could be right about the install bid.. dunno much about that. :idiot:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks for soo much replys ! :lol:

@Jdeb :

with or without the extra "\" does not seem to make a difference in all my "filecopy" commands ... ? but ok, i will use it in the future ...

@ezzetabi :

thanks a lot, BUT am i still using Auoit v3.0.102 and apparently the DllCall() function is not implemented in that version. :D

So i will have to move on to the "unstable" version v3.0.103 to use your solution.

Just how "unstable" is this new version ?

Are the .102 scripts still running fine on the .103 version ? :idiot:

I am using rather "simple" scripts...is it a great risk to plundge into .103 ?

Greetz

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
Link to comment
Share on other sites

I eventualy did it with an "old fashion" dos .BAT file and this .REG file :

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]

"Fixedsys (Set #6)"="vgafix_0.fon"

"Fixedsys for the IBM 8514"="8514fix0.fon"

"Terminal Font for the IBM 8514"="8514oem0.fon"

"System (Set #6)"="8514sys0.fon"

"Fixedsys 144 DPI"="m144fix.fon"

"Fixed (Set #4)"="m192fix.fon"

"3 of 9 Barcode (TrueType)"="3of9.ttf"

What i find very strange is that the autoit command "filecopy" does not do the same than the dos "Copy" command :

FileCopy($instdrv &"D:\progcel\autoit\*.fon", @WindowsDir & "\fonts\", 1)
FileCopy($instdrv &"D:\progcel\autoit\*.ttf", @WindowsDir & "\fonts\", 1)

after this, in C:\WINNT\FONTS the copied font-files all had a 0kb size ! ? :idiot:

with this DOS .BAT file :

copy d:\progcel\autoit\*.ttf c:\winnt\fonts\
copy d:\progcel\autoit\*.fon c:\winnt\fonts\

The copied fonts-files in C:\WINNT\FONTS had the correct size and after the execution of the .reg (with autoit), the fonts were installed ! :D

Why did "filecopy" not work ?

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
Link to comment
Share on other sites

FileCopy($instdrv &"D:\progcel\autoit\*.fon", @WindowsDir & "\fonts\", 1)
FileCopy($instdrv &"D:\progcel\autoit\*.ttf", @WindowsDir & "\fonts\", 1)

<{POST_SNAPBACK}>

That does not look right: What is $instdrv contain? FileCopy("D:\D:\progcel\autoit\*.ttf" ......

FileCopy("D:\progcel\autoit\*.ttf", @WindowsDir & "\fonts\", 1)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

@ezzetabi :

thanks a lot, BUT am i still using Auoit v3.0.102 and apparently the DllCall() function is not implemented in that version.  :D

So i will have to move on to the "unstable" version v3.0.103 to use your solution.

Just how "unstable" is this new version ?

Are the .102 scripts still running fine on the .103 version ?  :idiot:

I am using rather "simple" scripts...is it a great risk to plundge into .103 ?

<{POST_SNAPBACK}>

It is TOTALLY RISKLESS. The 'unstable' word apply to GUI commands that MAY change sintax, but they probably don't anymore. DllCall is pretty defined now, and it is very useful.
Link to comment
Share on other sites

@CyberSlug : Aargh ... I overlooked that one, sorry my mistake ! (too much copy/paste)

Thanks !

$instdrv is something i use to scan for the correct drive where i start my scripts from. It scans from drive C to Z. This way my scripts are found "dynamically". (if they are on a cd or on a network drive...)

$instdrv = ""
SplashTextOn("", "Looking for install drive...", 500, 22, 312 ,375 ,1 ,"system", "", "")
sleep(1000)
For $i = 67 to 91
    $instdrv = Chr($i)
    If FileExists($instdrv &":\my_scripts\autoit_script.exe") Then
       SplashTextOn("", "install drive found", 500, 22, 312 ,375 ,1 ,"system", "", "")
       sleep(1000)
       ExitLoop
    EndIf
Next
; if drive = chr(91) = "[" then the correct install drive was not found 
if $instdrv == "[" Then
   SplashTextOn("", "ERROR...INSTALL DRIVE NOT FOUND...ABORT", 500, 22, 312 ,375 ,1 ,"system", "", "")
   sleep(3000)
   exit
EndIf

@ezzetabi : Ok, i installed .103 and the newer Scite editor version + update and

all seems to be OK.

i'll try out the DllCall() and GUI tomorrow.

Thanks for all the help.

Edited by Gyzmok
D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
Link to comment
Share on other sites

$instdrv is something i use to scan for the correct drive where i start my scripts from. It scans from drive C to Z. This way my scripts are found "dynamically". (if they are on a cd or on a network drive...)

Just a quick note... you know the @ScriptDir macro?
Link to comment
Share on other sites

  • 9 months later...

$sFileName = 'C:\GAGGERS_.TTF'

Does this only work if the original font is already on the same machine? That is, can the source and target machines be different ones? I tried the script and it did not work. I've spent most of the day working on this ridiculous problem!

;) Figured it out. In order to test properly you need to reboot between deleting a test font and re-installing it with this script. And yes, it does work even if the source font is on a different machine. I have to install 300 fonts on 20 machines and doing this manually is just too tedious...

Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...