Archive: Folder.CopyHere to install fonts on Win7


Folder.CopyHere to install fonts on Win7 (VBScript)
  I've tried and tried, but I just couldn't get CopyFiles or File to install fonts on Windows 7. Then I stumbled on this VBScript that does work:

Const FONTS = &H14&
'/-> Path And Name To Font
Dim Font :Font = "PATH_FONT_NAME_HERE"
'/-> Objects
Dim Folder, Fso, Shell
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Shell = CreateObject("Shell.Application")
Set Folder = Shell.Namespace(FONTS)
'/-> Check For File Exists
If Fso.FileExists(Font) Then
Folder.CopyHere Font
Else
MsgBox "Missing " & Font,4128,"Missing Font"
End If


or simply:
Const FONTS = &H14&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(FONTS)
objFolder.CopyHere "PATH_TO_FONT"


The problem is that I don't know how to use that in NSIS. I've read http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx but I don't have a clue on how to convert that to NSIS.

I've tried System::Call and other stuff, but I guess I'm stupid and can't get it right.

Any help? Thanks :)

None of the Wiki scripts or plugins work?

Stu


Not for me.

Using FontReg.exe for now, is small enough and does what it's supposed to.


Worked fine for me using...
http://nsis.sourceforge.net/Register_Fonts
...

Just a few notes on it..
1. The page refers to the FontName plugin which seems to include the same script already as a header file. However, that header file does not have the latest update which allows you to use spaces in the font path. So make sure you adjust the header, or copy/paste the code from the wiki page.
2. Make sure your installer runs as Administrator. Non-administrators can't write to the Windows Fonts folder.
3.1 Make sure you don't forget "SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000" otherwise Windows won't know there's a new font.
3.2 The example on that page was missing the WinMessages.nsh include (required for the above two defines), I've adjusted this on that page now.

Platform: Windows 7 Home Premium NL 64bit
Code used:


5000
SectionEnd
>

@Animaether:

Thanks for your help here.

I have issue on Win7 Font Installation (works for me fine, but one User is reporting a Error-Message: "Ungültiges Dateihandle 32" (in German)

Look also here:
http://centrafuse.de/board/wbb/index...1401#post11401

Maybe you can post the right Header that i have to change?! That would be nice if you can help me with this.

Best Regards, Marcel.

(My nsi-Code is correct as you have posted.)


Ok, i have found one thing in line 60:

Changed it from:

${GetFileName} ${FontFile} $0


to:

${GetFileName} "${FontFile}" $0


Is all that i need?

Why i become this Error "Ungültiges Dateihandle 32"?

But only one User has this Issue (on Win7 64Bit).

Originally posted by MarcelP1977
${GetFileName} "${FontFile}" $0

Is all that i need?
It's the only header change that I noticed with regard to spaces in paths.

Originally posted by MarcelP1977
Why i become this Error "Ungültiges Dateihandle 32"?
No idea - I know what it's trying to say (invalid filehandle).. but don't know -why- it's saying it :)

Originally posted by MarcelP1977
But only one User has this Issue (on Win7 64Bit).
Could be that this specific user has a particular path either to the font file or the windows font folder? You could add some debug information (messageboxes or dump out to a file) for this particular user and see if that offers any clues.

There's also this previous post where as u user had the same error...
http://forums.winamp.com/showpost.ph...8&postcount=12
...where they fixed it by changing the location of the TTF file on the build machine; not sure how/why that matters, but worth a shot.

Thanks.

I have it allready as it in other thread is.

But maybe i can fix it with this changes?!

Old Code was:

!insertmacro InstallTTFFont 'GOTHIC.ttf'


and now i will try with this:

!insertmacro InstallTTFFont 'GOTHIC.TTF'


Thanks, i hope it works.