VBScript - Must be first statement on the line

Soldato
Joined
25 Oct 2009
Posts
6,706
Location
Caerphilly
Hi,
Keep getting this error:
Code:
C:\Documents and Settings\All Users\Application Data\CentraStage\Packages\587ab1a3-fea6-48ce-8451-24f81a801662#\command.vbs(12, 94) Microsoft VBScript compilation error: Must be first statement on the line
This is the script:
Code:
On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")

Dim strSimsVersion
strSimsVersion = ""

Select Case GetOSArch()
    Case 32
        strSimsVersion = objFSO.GetFileVersion("C:\Program Files\SIMS\SIMS .Net\pulsar.exe")
    Case 64
        strSimsVersion = objFSO.GetFileVersion("C:\Program Files (x86)\SIMS\SIMS .Net\pulsar.exe") End Select

Set WshShell = WScript.CreateObject("WScript.Shell")

If strSimsVersion = "" Then
    WScript.Echo "SIMS not detected"
    WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\CentraStage\Custom4", 'Not Installed', "REG_SZ" Else
    WScript.Echo "SIMS version: " & strSimsVersion
    WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\CentraStage\Custom4", strSimsVersion, "REG_SZ"
End If

Function GetOSArch()
    GetOSArch = GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth
End Function

Any ideas guys? I'm stumped.
 
Thanks Pho. Did that but im now getting this:

C:\Documents and Settings\All Users\Application Data\CentraStage\Packages\587ab1a3-fea6-48ce-8451-24f81a801662#\command.vbs(19, 97) Microsoft VBScript compilation error: Must be first statement on the line

It was 19, 94 but now 19, 97
 
Cheers guys, I've copied it into word but column 97 doesn't exist on line 19, line wo only has a maximum of column 34.

I moved the else to the next line but no different...
 
Back
Top Bottom