jamesb Posted August 5, 2011 Posted August 5, 2011 I've got the attached script, which works quite happily when I split it into segments. The problem comes when it's all together. Every time it runs, I get an Expected End error. I can't, for the life of me, see why or where it should go. Dim oAPIDim oBag Dim oShell Dim oFSO Dim oFolder Dim oFiles Dim iFileSize Dim iFileCount Dim sBackupFolder Dim fLatestBackup Dim dFileModDate Set oAPI = CreateObject("MOM.ScriptAPI") Set oBag = oAPI.CreatePropertyBag() Set oShell = WScript.CreateObject("WScript.Shell") sBackupFolder = oShell.Environment.item("BackupPath") Set oFSO = CreateObject("Scripting.FileSystemObject") if sBackupFolder <> "" then Set oFolder = oFSO.GetFolder(sBackupFolder) Set oFiles = oFolder.Files iFileSize = 0 iFileCount = 0 for each oFile in oFiles iFileCount = iFileCount + 1 iFileSize = iFileSize + oFile.Size if DateDiff("h", oFile.DateLastModified, Now) < 24 then sLatestBackup = oFile end if next if fLatestBackup <> "" then if fLatestBackup.Size => (iFileSize / iFileCount * 0.9) then Call oBag.AddValue("Status", "Valid") else if fLatestBackup.Size < (iFileSize / iFileCount * 0.9) then Call oBag.AddValue("Status", "Undersized") end if else Call oBag.AddValue("Status", "Missing") end if else Call oBag.AddValue("Status", "NoPath") end if Call oAPI.Return(oBag) Anyone got any ideas? I suspect I'm just tired and have missed something incredibly obvious.
jamesb Posted August 5, 2011 Author Posted August 5, 2011 Never mind - found it after a short lunchtime nap. I forgot that VBScript uses elseif rather than else if.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now