Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dim devRootPath
- dim appCount
- dim i
- dim baseAppExePath
- dim appEntry
- dim appMan
- dim str
- On Error Resume Next
- ' Overly used error handler to see where things failed
- Function CheckErr(where)
- If Err.Number <> 0 Then
- MsgBox("Got Error " & Err.Number & ", " & Err.Description & " from " & where)
- WScript.Quit(0)
- End If
- End Function
- ' Actual start of code
- set appMan = CreateObject("AppManDispatch.ApplicationManager")
- devRootPath = appMan.EnumDeviceRootPaths(0)
- WScript.Echo("Dev root path for Dev 0 = " & devRootPath)
- appCount = appMan.ApplicationCount
- WScript.Echo("App count: " & appCount)
- appCount = appMan.AdvancedMode ' Don't know what advanced mode means
- WScript.Echo("AdvancedMode: " & appCount)
- appCount = appMan.MaximumAvailableKilobytes(&H100FFFF)
- WScript.Echo("Max KB avail: " & appCount)
- WScript.Echo("setting app entries")
- 'baseAppExePath = "c:\Program Files\appmantest\apptestexe.exe"
- baseAppExePath = "apptestexe.exe"
- WScript.Echo("baseAppExePath is " & baseAppExePath)
- set appEntry = appMan.CreateApplicationEntry()
- CheckErr("CreateApplicationEntry")
- WScript.Sleep(2000)
- WScript.Echo("Setting properties")
- appEntry.Guid = "{1846FD5D-91EE-4503-B08F-4503062474B6}"
- CheckErr("Guid")
- appEntry.CompanyName = "Bob's Company"
- CheckErr("CompanyName")
- appEntry.Signature = "BobsGameSignature"
- CheckErr("Sig")
- appEntry.Category = 1
- CheckErr("Category")
- appEntry.EstimatedInstallKilobytes = 120000
- CheckErr("EstInstalled")
- WScript.Echo("Calling InitInstall")
- i = appEntry.InitializeInstall()
- CheckErr("InitializeInstall")
- str = appEntry.GetTemporarySpace(400)
- WScript.Echo("GetTempSpace(400) = " & str)
- appEntry.RemovableKilobytes = 0
- CheckErr("Removable")
- appEntry.NonRemovableKilobytes = 120000
- CheckErr("NonRemovable")
- 'appEntry.DownsizeCmdLine = baseAppExePath & "/downsize"
- 'CheckErr("DownsizeCmdLine")
- 'WScript.Echo("DownsizeCmdLine = " & appEntry.DownsizeCmdLine)
- 'appEntry.ReInstallCmdLine = baseAppExePath & "/reinstall"
- 'CheckErr("ReinstllCmdLine")
- 'appEntry.UninstallCmdLine = baseAppExePath & "/uninstall"
- 'CheckErr("UninstallCmdLine")
- 'appEntry.SelfTestCmdLine = baseAppExePath & "/self-test"
- 'CheckErr("SelfTestCmdLine")
- 'appEntry.ExecuteCmdLine = baseAppExePath & "/execute"
- 'CheckErr("ExecuteCmdLine")
- appEntry.ExecuteCmdLine = baseAppExePath
- CheckErr("ExecuteCmdLine")
- WScript.Echo("ExecuteCmdLine = " & appEntry.ExecuteCmdLine)
- 'appEntry.DefaultSetupExeCmdLine = baseAppExePath & "/defaultsetup"
- 'CheckErr("DefaultSetCmdLine")
- appEntry.DeveloperURL = "http://this.is.the.developer/Url"
- CheckErr("DevURL")
- appEntry.TitleURL = "http://this.is.the.title/Url"
- CheckErr("TitleURL")
- appEntry.PublisherURL = "http://this.is.the.publisher/Url"
- CheckErr("PubURL")
- appEntry.VersionString = "Bobs App V1.0.4"
- CheckErr("VerStr")
- appEntry.RemoveTemporarySpace(str)
- WScript.Echo("Calling FinalizeInstall")
- appEntry.FinalizeInstall()
- CheckErr("FinalizeInstall")
- appEntry.ApplicationRootPath = "C:\Program Files\appmantest\"
- CheckErr("AppRootPath")
- WScript.Echo("AppEntry State is " & appEntry.State)
- set appEntry = Nothing
- ' This bit lopps through the application categories and lists the
- ' max allowed kb and then the optimal available kb for each
- 'i = 0
- 'While i < &H10000
- ' appCount = appMan.MaximumAvailableKilobytes(i)
- ' WScript.Echo("Max KB Avail for cat " & Hex(i) & ":" & appCount)
- ' If i = 0 then
- ' i = 1
- ' else
- ' i = i * 2
- ' end if
- 'WEnd
- 'appCount = appMan.OptimalAvailableKilobytes(&H100FFFF)
- 'WScript.Echo("Optimal KB avail: " & appCount)
- 'i = 0
- 'While i < &H10000
- ' appCount = appMan.OptimalAvailableKilobytes(i)
- ' WScript.Echo("Optimal KB Avail for cat " & Hex(i) & ":" & appCount)
- ' If i = 0 then
- ' i = 1
- ' else
- ' i = i * 2
- ' end if
- 'WEnd
- 'WScript.Echo("Finished loop, exiting")
- set appMan = Nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement