$exec » History » Version 3
Per Amundsen, 08/01/2017 12:22 AM
| 1 | 1 | Per Amundsen | _Added in 2.9_ |
|---|---|---|---|
| 2 | |||
| 3 | *$exec(filename, [nh], [arguments])* |
||
| 4 | |||
| 5 | Executes a program and returns the output, if any. |
||
| 6 | |||
| 7 | 3 | Per Amundsen | _This identifier will block the AdiIRC user interface until the executed program is closed/finished._ |
| 8 | 1 | Per Amundsen | |
| 9 | *Parameters* |
||
| 10 | |||
| 11 | filename - Filename of the program to execute. |
||
| 12 | [nh] - n = minimize the window, h = hide the window. |
||
| 13 | [arguments] - Arguments to pass to the program. |
||
| 14 | |||
| 15 | *Example* |
||
| 16 | |||
| 17 | <pre> |
||
| 18 | 2 | Per Amundsen | ; Print all files and folders in the config folder: |
| 19 | 1 | Per Amundsen | alias testexec { |
| 20 | 2 | Per Amundsen | |
| 21 | ; Put the entire output into a variable. |
||
| 22 | var %output = $exec(cmd.exe, h, /c dir $qt($adiircdir)) |
||
| 23 | 1 | Per Amundsen | var %s 0 |
| 24 | |||
| 25 | 2 | Per Amundsen | ; Loop the variable based on the $lf (newline) character. |
| 26 | 1 | Per Amundsen | while (%s < $gettok(%output, 0, 10)) { |
| 27 | inc %s |
||
| 28 | 2 | Per Amundsen | |
| 29 | ; print the Nth line. |
||
| 30 | 1 | Per Amundsen | echo -ag $gettok(%output, %s, 10) |
| 31 | } |
||
| 32 | } |
||
| 33 | </pre> |