Project

General

Profile

$exec » History » Version 4

Per Amundsen, 02/16/2023 09:38 PM

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