Documentation

array

Syntax: %array(values)

return an array filled with values. Only the #VAR command can store an array. You can also pass an array to any of the COM/OLE functions.

Examples:

#VAR a %array(1,2,3)

creates an array of 3 elements. The first element (element 0) has a value of 1, the second has a value of 2, etc.

#VAR a %array(1,"hello",3)

creates an array of 3 elements. The first element (element 0) has a value of 1, the second has a value of "hello", etc. Notice that you can mix both numbers and strings in the array contents.

#VAR TeSSH %comcreate("TeSSH.Application")
#VAR ss %comget(TeSSH,"CurrentSession")
#COM ss "CMUDCommand" 216 %array("varname","value")


ok, here's a tricky one. This is COM code. First we store a link to the COM Server "TeSSH.Application", which is TeSSH itself. Then we access the "CurrentSession" property of TeSSH and store that session in ss; a shorter means to this would be to use the %session predefined variable. Then we execute the "CMUDCommand" method of the current session. The CMUDCommand method takes two arguments: the first is the command ID to use. These IDs are documented in the TeSSH.INC file in the [url=\"http://www.zuggsoft.com/TeSSH/down.asp#Developer\"]Developer's Kit[/url]. ID number 216 corresponds to the #VAR command. The second argument for CMUDCommand is an Array of values to pass to the command. In this case, we pass an array with the elements "varname" and "value". So, this ends up executing: "#VAR varname value" which will create a variable in the current session.

Not a very practical example, but it *does* show how you use %array in a COM statement if you need it.

Add comment

Login or register to post comments