$group » History » Version 2
Per Amundsen, 08/11/2015 01:13 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$group(#|N)* |
||
| 4 | |||
| 5 | Returns the name or status of a [[Scripting_Groups|#group]] in a script. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | #|N - Group name or if N = 0, number of groups, otherwise the Nth group. |
||
| 10 | |||
| 11 | *Properties* |
||
| 12 | |||
| 13 | .status - Returns on or off. |
||
| 14 | .fname - Returns the script filename in which the group exists. |
||
| 15 | .name - Returns name of the group. |
||
| 16 | |||
| 17 | *Examples* |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | ; Create a group |
||
| 21 | #example on |
||
| 22 | alias Example { |
||
| 23 | echo -ag Group works |
||
| 24 | } |
||
| 25 | 2 | Per Amundsen | #example end |
| 26 | 1 | Per Amundsen | |
| 27 | ; Print number of groups. |
||
| 28 | //echo -ag $group(0) |
||
| 29 | |||
| 30 | ; Print the '#example' group status. |
||
| 31 | //echo -ag #example1 is $group(#example1).status |
||
| 32 | |||
| 33 | ; Disable the '#example' group |
||
| 34 | /disable #example |
||
| 35 | |||
| 36 | ; Print the '#example' group status again. |
||
| 37 | //echo -ag #example1 is $group(#example1).status |
||
| 38 | </pre> |