'------ Admin rights!
' source: https://stackoverflow.com/a/17467283
If Not WScript.Arguments.Named.Exists("elevate") Then
  CreateObject("Shell.Application").ShellExecute WScript.FullName _
    , """" & WScript.ScriptFullName & """ /elevate", "", "runas", 1
  WScript.Quit
End If




' Dim fso: set fso = CreateObject("Scripting.FileSystemObject")
' Dim current_dir
' current_dir = fso.GetAbsolutePathName(".")

dim scriptdir
scriptdir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)



dim geexlab_full_path 
geexlab_full_path = scriptdir & "\GeeXLab.exe"

dim command_value
' Chr(34) for double quote (")
command_value = geexlab_full_path & " " & "/demofile=" & Chr(34) & "%1" & Chr(34) & " /demofile_abs_path=1"


dim icon_full_path 
icon_full_path = scriptdir & "\icon.ico"



'------ Update the registry.
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_CLASSES_ROOT\*\shell\Open with GeeXLab x32\command\", command_value, "REG_SZ"
WshShell.RegWrite "HKEY_CLASSES_ROOT\*\shell\Open with GeeXLab x32\", "Open demofile with GeeXLab x32", "REG_SZ"
WshShell.RegWrite "HKEY_CLASSES_ROOT\*\shell\Open with GeeXLab x32\Icon", icon_full_path, "REG_SZ"

dim crlf
crlf = Chr(13) & Chr(10)

Wscript.Echo "GeeXLab 32-bit full path:" & vbCrLf & geexlab_full_path & vbCrLf & vbCrLf & "GeeXLab added to Explorer context menu."

