Deployment Script for the very cool Convert utility

by Jeremy on November 29, 2009

Here is a deployment script for the very cool convert.exe utility from Josh Madison.

Enjoy!

InstallConvert.vbs


' Installation script for convert.exe (http://www.joshmadison.com/software)
'
' Notes:
' 1) Even though this a a 32-bit application...
'    i) It will still run 100% correctly in a 64-bit environment.
'    ii) In a 64-bit environment we deploy it to the "%ProgramFiles%"
'        location and not the "%ProgramFiles(x86)%" location. This provides
'        a single location for the published application regardless of the
'        system architecture type.
'
' Revision 1.2 on 21st October 2009.
' Written by Jeremy@jhouseconsulting.com on 30th December 2008.
'
Option Explicit

Dim objfso, objFolder, wshShell, oShellLink, strAUPrograms, strAUDesktop
Dim strProgramFiles, strScriptPath, blnStartMenuShortcut, blnDesktopShortcut

blnStartMenuShortcut = True
blnDesktopShortcut = False

set WshShell = WScript.CreateObject("WScript.Shell")
set objfso = CreateObject("Scripting.FileSystemObject")

strProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
strAUPrograms = WshShell.SpecialFolders("AllUsersPrograms")
strAUDesktop = WshShell.SpecialFolders("AllUsersDesktop")
strScriptPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))

If objFSO.FileExists(strScriptPath & "Convert.exe") Then
  If NOT objFSO.FolderExists(strProgramFiles & "\JoshMadison") Then
    Set objFolder = objFSO.CreateFolder(strProgramFiles & "\JoshMadison")
  End If
  If NOT objFSO.FolderExists(strProgramFiles & "\JoshMadison\convert") Then
    Set objFolder = objFSO.CreateFolder(strProgramFiles & "\JoshMadison\convert")
  End If
  objFSO.CopyFile strScriptPath & "Convert.exe", strProgramFiles & "\JoshMadison\convert\", True
  If blnStartMenuShortcut Then
    Set oShellLink = WshShell.CreateShortcut(strAUPrograms & "\Convert.lnk")
    oShellLink.TargetPath = chr(34) & strProgramFiles & "\JoshMadison\convert\convert.exe" & chr(34)
    oShellLink.WorkingDirectory= strProgramFiles & "\JoshMadison\convert"
    oShellLink.IconLocation = strProgramFiles & "\JoshMadison\convert\convert.exe" & ",0"
    oShellLink.Save
  End If
  If blnDesktopShortcut Then
    Set oShellLink = WshShell.CreateShortcut(strAUDesktop & "\Convert.lnk")
    oShellLink.TargetPath = chr(34) & strProgramFiles & "\JoshMadison\convert\convert.exe" & chr(34)
    oShellLink.WorkingDirectory= strProgramFiles & "\JoshMadison\convert"
    oShellLink.IconLocation = strProgramFiles & "\JoshMadison\convert\convert.exe" & ",0"
    oShellLink.Save
  End If
End If

Set WshShell = Nothing
Set objfso = Nothing
Set objFolder = Nothing
Set oShellLink = Nothing

WScript.Quit(0)

Related posts:

  1. Deployment Script for the Repair Clipboard Chain utility
  2. Deployment Script for the Ctrl-Alt-Del IT Consultancy Tools
  3. The Challenges of Using VBScript to Create Shortcuts

Leave a Comment

 

Previous post:

Next post: