Advertisement
Guest User

DX8 Application Manager Sample VBS

a guest
Aug 28th, 2014
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dim devRootPath
  2. dim appCount
  3. dim i
  4. dim baseAppExePath
  5. dim appEntry
  6. dim appMan
  7. dim str
  8.  
  9. On Error Resume Next
  10.  
  11. ' Overly used error handler to see where things failed
  12. Function CheckErr(where)
  13. If Err.Number <> 0 Then
  14.     MsgBox("Got Error " & Err.Number & ", " & Err.Description & " from " & where)
  15.     WScript.Quit(0)
  16. End If
  17. End Function
  18.  
  19. ' Actual start of code
  20. set appMan = CreateObject("AppManDispatch.ApplicationManager")
  21. devRootPath = appMan.EnumDeviceRootPaths(0)
  22. WScript.Echo("Dev root path for Dev 0 = " & devRootPath)
  23. appCount = appMan.ApplicationCount
  24. WScript.Echo("App count: " & appCount)
  25. appCount = appMan.AdvancedMode ' Don't know what advanced mode means
  26. WScript.Echo("AdvancedMode: " & appCount)
  27. appCount = appMan.MaximumAvailableKilobytes(&H100FFFF)
  28. WScript.Echo("Max KB avail: " & appCount)
  29. WScript.Echo("setting app entries")
  30.  
  31. 'baseAppExePath = "c:\Program Files\appmantest\apptestexe.exe"
  32. baseAppExePath = "apptestexe.exe"
  33. WScript.Echo("baseAppExePath is " & baseAppExePath)
  34.  
  35. set appEntry = appMan.CreateApplicationEntry()
  36. CheckErr("CreateApplicationEntry")
  37. WScript.Sleep(2000)
  38. WScript.Echo("Setting properties")
  39. appEntry.Guid = "{1846FD5D-91EE-4503-B08F-4503062474B6}"
  40. CheckErr("Guid")
  41. appEntry.CompanyName = "Bob's Company"
  42. CheckErr("CompanyName")
  43. appEntry.Signature = "BobsGameSignature"
  44. CheckErr("Sig")
  45. appEntry.Category = 1
  46. CheckErr("Category")
  47. appEntry.EstimatedInstallKilobytes = 120000
  48. CheckErr("EstInstalled")
  49. WScript.Echo("Calling InitInstall")
  50. i = appEntry.InitializeInstall()
  51. CheckErr("InitializeInstall")
  52. str = appEntry.GetTemporarySpace(400)
  53. WScript.Echo("GetTempSpace(400) = " & str)
  54. appEntry.RemovableKilobytes = 0
  55. CheckErr("Removable")
  56. appEntry.NonRemovableKilobytes = 120000
  57. CheckErr("NonRemovable")
  58.  
  59. 'appEntry.DownsizeCmdLine = baseAppExePath & "/downsize"
  60. 'CheckErr("DownsizeCmdLine")
  61. 'WScript.Echo("DownsizeCmdLine = " & appEntry.DownsizeCmdLine)
  62. 'appEntry.ReInstallCmdLine = baseAppExePath & "/reinstall"
  63. 'CheckErr("ReinstllCmdLine")
  64. 'appEntry.UninstallCmdLine = baseAppExePath & "/uninstall"
  65. 'CheckErr("UninstallCmdLine")
  66. 'appEntry.SelfTestCmdLine = baseAppExePath & "/self-test"
  67. 'CheckErr("SelfTestCmdLine")
  68. 'appEntry.ExecuteCmdLine = baseAppExePath  & "/execute"
  69. 'CheckErr("ExecuteCmdLine")
  70. appEntry.ExecuteCmdLine = baseAppExePath
  71. CheckErr("ExecuteCmdLine")
  72. WScript.Echo("ExecuteCmdLine = " & appEntry.ExecuteCmdLine)
  73. 'appEntry.DefaultSetupExeCmdLine = baseAppExePath & "/defaultsetup"
  74. 'CheckErr("DefaultSetCmdLine")
  75. appEntry.DeveloperURL = "http://this.is.the.developer/Url"
  76. CheckErr("DevURL")
  77. appEntry.TitleURL = "http://this.is.the.title/Url"
  78. CheckErr("TitleURL")
  79. appEntry.PublisherURL = "http://this.is.the.publisher/Url"
  80. CheckErr("PubURL")
  81. appEntry.VersionString = "Bobs App V1.0.4"
  82. CheckErr("VerStr")
  83.  
  84. appEntry.RemoveTemporarySpace(str)
  85. WScript.Echo("Calling FinalizeInstall")
  86. appEntry.FinalizeInstall()
  87. CheckErr("FinalizeInstall")
  88. appEntry.ApplicationRootPath = "C:\Program Files\appmantest\"
  89. CheckErr("AppRootPath")
  90. WScript.Echo("AppEntry State is " & appEntry.State)
  91. set appEntry = Nothing
  92.  
  93. ' This bit lopps through the application categories and lists the
  94. ' max allowed kb and then the optimal available kb for each
  95. 'i = 0
  96. 'While i < &H10000
  97. '   appCount = appMan.MaximumAvailableKilobytes(i)
  98. '   WScript.Echo("Max KB Avail for cat " & Hex(i) & ":" & appCount)
  99. '   If i = 0 then
  100. '      i = 1
  101. '   else
  102. '      i = i * 2
  103. '   end if
  104. 'WEnd
  105. 'appCount = appMan.OptimalAvailableKilobytes(&H100FFFF)
  106. 'WScript.Echo("Optimal KB avail: " & appCount)
  107. 'i = 0
  108. 'While i < &H10000
  109. '   appCount = appMan.OptimalAvailableKilobytes(i)
  110. '   WScript.Echo("Optimal KB Avail for cat " & Hex(i) & ":" & appCount)
  111. '   If i = 0 then
  112. '      i = 1
  113. '   else
  114. '      i = i * 2
  115. '   end if
  116. 'WEnd
  117. 'WScript.Echo("Finished loop, exiting")
  118. set appMan = Nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement