Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Directory Referencing
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mbslrm




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
DragonForce4




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: