GetCommandList
Script function

world.GetCommandList

DOC_scripting Read about scripting

Type

Method

Summary

Returns some or all commands from the command history

Prototype

VARIANT GetCommandList(long Count);

DOC_data_types View list of data type meanings


Description

This returns a variant array of the nominated number of most recent commands (in the command history window).

You can get all available commands by requesting a count of zero. (You can get the most recently saved command by requesting a count of 1).

If you request more than the available number, then the number of items in the array may be less than that requested.

You can get the current command (not yet in the command history list) by using world.GetCommand.



VBscript example

dim commandList
dim iCount

'
' Get last 10 commands
'
  commandList = world.GetCommandList (10)

  If Not IsEmpty (commandList) Then
    For Each command In commandList  
      world.Note command 
    Next
  End If

'
' ------------------------
'

'
' Get most recent command
'

  world.note world.getcommandlist (1) (0)



Jscript example

//
// Get last 10 commands
//
  
  commandList = new VBArray(world.GetCommandList (10)).toArray();

  if (commandList) 
    for (i = 0; i < commandList.length; i++)
        world.note (commandList [i]);



PerlScript example

#
#  Get last 10 commands
#

foreach $item (Win32::OLE::in ($world->GetCommandList (10)))
 {
 $world->note($item);
 }



Python example

#
# Get last 10 commands
#

commandList = world.GetCommandList (10)
if (commandList ):
  for c in commandList : world.Note (c)



Lua example

--
-- Get last 10 commands
--

for k, v in pairs (GetCommandList (10)) do 
  Note (v) 
end



Return value

If there are no commands in the history list then the return value is empty. Use "IsEmpty" to test for this possibility.

Otherwise, it returns a variant array containing the specified number of commands (counting from the most recent). Use "ubound" to find the number of commands in the list.




See Also ...

Functions

FNC_GetCommand GetCommand (Gets the current command in the command window)
FNC_PushCommand PushCommand (Pushes the current command into the command history list)
FNC_SelectCommand SelectCommand (Selects (highlights) the current command in the command window)
FNC_SetCommand SetCommand (Sends text to the command window)

(Help topic: function=GetCommandList)

DOC_contents Documentation contents page