Computer Science Canada

Directory Referencing

Author:  mbslrm [ Wed Jun 03, 2009 10:15 pm ]
Post subject:  Directory Referencing

I've got this script from someone I know that basically copies a font file to the Font Directory.

VB:

const FONTS = &H14&

Set objShell = CreateObject("Shell.Application")
Set ObjFolder = objShell.Namespace(FONTS)
objFolder.CopyHere "I:\Game\bubble.ttf"


However, I need this script to run on many computers, and I can't hardcode the directory. How can I make it so that it copies the file from within the directory?

Author:  DragonForce4 [ Thu Jun 04, 2009 8:13 pm ]
Post subject:  RE:Directory Referencing

have your program in a folder on the cd (eg lets call it game)

code:

Const FONTS = &H14&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(FONTS)
objFolder.CopyHere "game\bubble.ttf"


as long as your program, the font file, and the vbs are in a folder called game, it will install it

also
to open it in turing convert the vbs to an exe
http://www.f2ko.de/ov2e/ov2e.html
there

and save the exe in the same folder as your game
then do something like this (where font.exe is the vbs you converted)

Turing:

if not Sys.Exec ("font.exe") then
    cls
    put "Font install failed", Error.LastMsg
    delay (1000)
end if


which will install the font, and display an error message if the font fails to install.


: