'AddAuxCommandReporter.vbs 'Rick Shaddock, Rick@CICorp.com, 202-829-4444'AddCommand.vbs 'This example adds custom command CMDTEST Dim objCommands 'As Object Dim nRet 'As Long dim cCommand cCommand ="Reporter" 'Create the Commands object Set objCommands = CreateObject("ACTOLE.AUXCMDS") szCommandName = cCommand szCommandLine = "c:\ACT\Addon\EcMS\" & cCommand & ".exe" szStartIn = "c:\ACT\Addon\EcMS" szToolTip = cCommand szDescription = ccommand szSmallIconPath = "c:\act\addon\EcMS\" & cCommand & ".ico" szLargeIconPath = "c:\act\addon\EcMS\" & cCommand & ".ico" iRunState = 1 '0=Background, 1 =Normal, 2=Maximized iCommandID = 304 'Edit > Paste nRet = objCommands.AddAuxCommand(szCommandName, szCommandLine, szStartIn, szToolTip, szDescription, szSmallIconPath, szLargeIconPath, iRunState) If nRet <> 0 Then if nRet =102 then MsgBox "S_NOT_FOUND Command or toolbar icon not defined" elseif nRet =117 then MsgBox "S_INVALID_INPUT Required input parameter is 0 or null" elseif nRet =134 then MsgBox "S_MEM_ERROR Limit of 300 added commands exceeded" elseif nRet =157 then MsgBox "S_DUPLICATE Command being added already exists" elseif nRet =163 then MsgBox "S_INVALID_ID Invalid View ID specified" else MsgBox "Error adding custom command " & nRet end if Else: MsgBox "Custom command added successfully: " & cCommand 'Check if the command exists, only then add it to the toolbar If objCommands.AuxCommandExists(cCommand) Then nRet = objCommands.AddAuxCommandToToolbar(1, cCommand) If nRet = 0 Then MsgBox "Command successfully added to toolbar: " & cCommand Else MsgBox "Error adding the command to the toolbar: " & cCommand & " " &nRet End if Else MsgBox "The Command does not exist. Please use the method AddAuxCommand first! " & cCommand End If End If 'Clear the object Set objCommands = Nothing '0 S_OK Success '102 S_NOT_FOUND Command or toolbar icon not defined '117 S_INVALID_INPUT Required input parameter is 0 or null '134 S_MEM_ERROR Limit of 300 added commands exceeded '157 S_DUPLICATE Command being added already exists '163 S_INVALID_ID Invalid View ID specified