+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, Flash VBScript Install Script in Coding and Web Development; ...
  1. #1

    Join Date
    May 2010
    Posts
    1,031
    Thank Post
    105
    Thanked 87 Times in 64 Posts
    Rep Power
    49

    Flash VBScript Install Script

    I found a nice VBScript that installs java (checks versions, uninstalls old and installs latest) - works really well.
    So i took it upon myself to create / hack about with the script for adobe flash (currently the directX for IE)
    So does this look ok ? - Seems to run fine - ignore the environment variables (c:\flash)
    Its quick and dirty, not done any vb in years!
    Might seem overkill I guess, but it logs which machines have it installed - similar to the java one i found.

    Code:
    Option Explicit
    
    Dim wshShell, fso, strLogFile, ts, strTempDir, strUnString, tsIn
    Dim CLSID, strDisplayName, strDisplayVersion
    Dim strPublisher, strUninstLine
    Dim search1, search2, search3
    Dim strComputername, strCurrentVersion, strInstallMST
    Dim searchCurVer, CurVerFound, strLogPath, strInstallCMD, strInstallMSI, strInstallLog
    Dim flashversion
    
    '# Change this to match the current version. 
    
    strCurrentVersion = "10.1.85.3"
    
    '#change this for log path
    
    strLogPath = "c:\flash\"
    
    '#change this for install path
    
    strInstallMSI = "c:\flash\install_flash_player_10_active_x.msi" 
    
    Set wshShell = CreateObject("WScript.Shell") 
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    strComputername = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
    strInstallLog = strLogPath & "Flash_Install_" & strComputername & ".log"
    strInstallCMD = "msiexec /I " & strInstallMSI & " /quiet"
    
    '#some other code
    
    PreFlight()
    
    strTempDir = wshShell.ExpandEnvironmentStrings("%TEMP%")
    Set tsIn = fso.OpenTextFile(strTempDir & "\uninstall.tmp", 1)
    
    Do While Not tsIn.AtEndOfStream
       strUninstLine = tsIn.ReadLine 
       CLSID = Mid(strUninstLine, 73, 38) 
    
       On Error Resume Next
    
       strDisplayName = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\DisplayName") 
       strPublisher = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\Publisher") 
       strDisplayVersion = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\DisplayVersion") 
    
       On Error Goto 0
    
       'Search for presence of flash in DisplayName and Publisher
        
       search1 = Instr(1, strDisplayName, "Adobe Flash Player 10 ActiveX", 1) 
       search2 = Instr(1, strPublisher, "Adobe Systems Incorporated", 1) 
       search3 = Instr(1, strDisplayVersion, strCurrentVersion, 1)
        
          
       'See if it is the current version
       searchCurVer = InStr(1, strDisplayVersion, strCurrentVersion, 1)
    
       'If it is, Show that the current version is found
       If searchCurVer > 0 Then
         
         CurVerFound = True
         flashversion = strDisplayVersion
        
         ElseIf searchCurVer <> 0 Then
         
    	CurVerFound = False
    				
         End If
          
    Loop   
    
    tsIn.Close()
    
     Set ts = fso.OpenTextFile(strInstallLog, 8, True)
    
    If CurVerFound = True Then
    
    	ts.WriteLine Now() & " Flash - Current version, " & flashversion & " found - No Update Needed."
    
    	ts.close
          
          WScript.Quit()
          
    ElseIf CurVerFound =false Then
    
    	ts.writeline now() & " Flash Not Found,  New Installation started"
    	   
        wshshell.run(strInstallCMD)
    
        ts.writeline now() & " " & strCurrentVersion & " Installed"
    
         ts.close
    
    	WScript.quit()
    	
    End If
    
    Sub PreFlight()
       '# Creates temp files containing extracts from registry 'Uninstall' keys.
       Dim wshShell, fso, sTemp
       Set wshShell = CreateObject("WScript.Shell")
       Set fso = CreateObject("Scripting.FileSystemObject")
       sTemp = wshShell.ExpandEnvironmentStrings("%temp%")
       wshShell.Run "REGEDIT /E %temp%\registry.tmp HKEY_LOCAL_MACHINE\SOFTWARE\microsoft\windows\currentversion\uninstall", 0, True
       wshShell.Run "cmd /c type %temp%\registry.tmp | find /i ""{"" | find /i ""}]"" > %temp%\uninstall.tmp ", 0, True
       
       If Not fso.FileExists(sTemp & "\uninstall.tmp") Then
           ts.WriteLine Now() & " - No input - %temp%\uninstall.tmp Reg extract not created."
           ts.WriteLine String(120, "_") 
           ts.WriteLine String(120, "¯") 
           ts.Close
           WScript.Quit(1)
       End If
    End Sub

  2. #2

    Join Date
    May 2010
    Posts
    1,031
    Thank Post
    105
    Thanked 87 Times in 64 Posts
    Rep Power
    49
    cleaned it up a lot, i reckon the reg key for flash won't change - so i slimmed the script down as much as i could still a bit rough ?.

    Code:
    Option Explicit
    
    Dim wshShell, fso, strLogFile, ts, strTempDir
    Dim strDisplayName, strVersion
    Dim search, flashversion
    Dim strComputername, strCurrentVersion, strInstallMST
    Dim searchCurVer, CurVerFound, strLogPath, strInstallCMD, strInstallMSI, strInstallLog
    
    '# Change this to match the current version. 
    
    strCurrentVersion = "10.1.85.3"
    
    '#change this for log path
    
    strLogPath = "c:\flash\"
    
    '#change this for install path
    
    strInstallMSI = "c:\flash\install_flash_player_10_active_x.msi" 
    
    Set wshShell = CreateObject("WScript.Shell") 
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    strComputername = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
    strInstallLog = strLogPath & "Flash_Install_" & strComputername & ".log"
    strInstallCMD = "msiexec /I " & strInstallMSI & " /quiet"
    
    strTempDir = wshShell.ExpandEnvironmentStrings("%TEMP%")
    
    On Error Resume Next
    
    strVersion = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayerActiveX\Version") 
    
    On Error Goto 0
    
       searchCurVer = InStr(1, strVersion, strCurrentVersion, 1)
    
       If searchCurVer > 0 Then
         
         CurVerFound = True
    
         flashversion = strVersion
       
       ElseIf searchCurVer <> 0 Then
         
    	CurVerFound = False
     
       End If
    
    Set ts = fso.OpenTextFile(strInstallLog, 8, True)
    
    If CurVerFound = True Then
    
    	ts.WriteLine Now() & " Flash - Current version, " & flashversion & " found - No Update Needed."
    
    	ts.close
          
        WScript.Quit()
          
    ElseIf CurVerFound = False Then
    
    	ts.writeline now() & " Flash Not Found,  New Installation started"
    	   
        wshshell.run(strInstallCMD)
    
        ts.writeline now() & " " & strCurrentVersion & " Installed"
    
        ts.close
    
        WScript.quit()
    	
    End If

SHARE:
+ Post New Thread

Similar Threads

  1. install flash
    By duxbuz in forum How do you do....it?
    Replies: 0
    Last Post: 17th March 2010, 03:55 PM
  2. Printer install via vbscript
    By LeightonJames in forum Windows
    Replies: 4
    Last Post: 14th December 2009, 09:43 AM
  3. Replies: 1
    Last Post: 18th September 2009, 09:26 AM
  4. Action Script 2.0 to 3.0 CS4 Flash
    By andy_nic in forum Coding
    Replies: 0
    Last Post: 28th July 2009, 08:28 AM
  5. Flash Player 9 and Shockwave Install
    By ICTNUT in forum Windows
    Replies: 20
    Last Post: 16th January 2007, 09:29 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •