Skip to content

Commit 3fcc57f

Browse files
BlueboyZXEtienneLamoureux
authored andcommitted
Generate shortcut via .vbs
This adds MakeShortcut.vbs, which can produce a Windows shortcut with the installation's current absolute location. This lets the shortcut remain functionality when a user copies it to other locations like their Desktop. This .vbs file requires sc-trade-companion.ico on the same folder as the script.
1 parent 5c45726 commit 3fcc57f

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

scripts/MakeShortcut.vbs

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
'Option Explicit
2+
3+
Dim strLink
4+
Dim strTargetPath
5+
Dim strScriptFolder
6+
Dim strTarget
7+
Dim strIcon
8+
Dim strJarLocation
9+
10+
' Define variables (modify paths as needed)
11+
12+
'These two lines will create a string containing the folder that the script is in
13+
'without including the file name of the script itself
14+
Set fso = CreateObject("Scripting.FileSystemObject")
15+
strScriptFolder = fso.GetParentFolderName(WScript.ScriptFullName)
16+
17+
18+
'The icon is assumed to be in the same path as the script
19+
strLink = "\Star Citizen Trade Companion.lnk" ' Shortcut name
20+
strTargetPath = "\bin\jre\bin\javaw.exe" ' Target relative path
21+
strTarget = strScriptFolder & strTargetPath ' Combine paths
22+
strIcon = strScriptFolder & "\sc-trade-companion.ico" ' Icon path (assuming in same folder)
23+
strJarLocation = strScriptFolder & "\bin\sc-trade-companion.jar"
24+
25+
26+
27+
28+
' Create WScript.Shell object
29+
Set WShell = CreateObject("WScript.Shell")
30+
31+
' Create the shortcut object in the script folder
32+
' **Use CreateObject with single argument (corrected concatenation)**
33+
Set shortcut = WShell.CreateShortcut(strScriptFolder & "\" & strLink)
34+
35+
' Set shortcut properties
36+
shortcut.TargetPath = strTarget
37+
shortcut.Arguments = "-Xmx512m -jar " & Chr(34) & strJarLocation & Chr(34) ' Set command-line arguments
38+
shortcut.WorkingDirectory = strScriptFolder
39+
shortcut.WindowStyle = 1 ' Minimized (optional)
40+
shortcut.Description = "Star Citizen Trade Companion"
41+
42+
' Set icon location
43+
shortcut.IconLocation = strIcon
44+
45+
' Save the shortcut
46+
shortcut.Save
47+
48+
' Display success message
49+
'WScript.Echo "Shortcut created successfully!"

scripts/sc-trade-companion.ico

97.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)