Page 1 of 1

Create Shortcut

PostPosted: Thu Feb 07, 2002 3:34 pm
by Jim Brammer
(*Be aware of word wrap in this msg)

If you are creating your own custom setup using NeoBook's ExtractFile command and your program does not use a PlugIn, - or the PlugIn you're using does not have a Create Shortcut function - you're in luck. Use this to create a Shortcut in the Start Menu. Replace "My Program" with the actual name of your program and filenames.


<font size=-2>
SetVar "[INF]" "[TempDir]Scut.INF"

SetVar "[GROUP_TITLE]" "My Program Group"
SetVar "[LONG_FILENAME]" "C:\Program Files\My Program Folder\My Program.EXE"
SetVar "[SCUT_TITLE]" "My Program"
SetVar "[SHORT_FILENAME]" "MYPROG~1.EXE"

FileExists "[INF]" "[INF_Ex]"
If "[INF_Ex]" "=" "True"
FileErase "[INF]"
EndIf

FileWrite "[INF]" "Append" "[#91]Version[#93]"
FileWrite "[INF]" "Append" "Signature=$Chicago$"
FileWrite "[INF]" "Append" "[#91]DefaultInstall[#93]"
FileWrite "[INF]" "Append" "UpdateInis=Addlink"
FileWrite "[INF]" "Append" "[#91]Addlink[#93]"
FileWrite "[INF]" "Append" "setup.ini, progman.groups,, [#34]group1=[GROUP_TITLE][#34]"
FileWrite "[INF]" "Append" "setup.ini, group1,, [#34][#34][#34][SCUT_TITLE][#34][#34],[#34][#34][#34][#34][#34][#34][LONG_FILENAME][#34][#34][#34][#34][#34][#34],,,,[#34][#34][STARTUP_DIR][#34][#34],[#34][#34][SHORT_FILENAME][#34][#34][#34]"
Delay "250"
Run "[WindowsDir]\rundll.exe" "setupx.dll,InstallHinfSection DefaultInstall 132 [INF]" "Normal"
Delay "250"
FileErase "[INF]"
</font>


* Note: You 'll need to get the short filenames of your files. If you're installing your program into it's own folder and each filename is distinctly different than the next then the filename will always be the first 6 characters, tilda, 1

123456~1.EXT
MYPROG~1.EXE

The best thing to do is just go to the DOS prompt and do a directory to view all your filenames. This way if you have two or more files with alike filenames you'll be able to see exactly how they are named...

My Data File 01.DAT = MYDATA~1.DAT
My Data File 02.DAT = MYDATA~2.DAT

If you need to create a Shortcut on the Desktop just use the FileCopy command to copy the .LNK file to the Desktop...

<font size=-2>
FileCopy "[WindowsDir]\Start Menu\My Program Group\My Program.LNK" "[WindowsDir]\Desktop\My Program.LNK"
</font>

Jim



(Edited by Jim Brammer at 5:39 pm on Feb. 7, 2002)