Terminal control/Dimensions: Difference between revisions

m
(→‎Visual Basic .NET: Listed example is .net, not classic vb)
Tags: Mobile edit Mobile web edit
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 127:
Number of rows: 24
</pre>
 
=={{header|AppleScript}}==
<syntaxhighlight lang="AppleScript">local numColumns, numRows
tell application "Terminal"
if not running then activate
set {numColumns, numRows} to {number of columns, number of rows} of tab 1 of window 1
end tell
</syntaxhighlight>
 
=={{header|Applesoft BASIC}}==
Line 872 ⟶ 880:
=={{header|Wren}}==
As there is currently no way to obtain this information via Wren CLI, we instead embed a Wren script in a C application and ask the host program to get it for us.
<syntaxhighlight lang="ecmascriptwren">/* terminal_control_dimensionsTerminal_control_Dimensions.wren */
 
class C {
Line 886 ⟶ 894:
<br>
We now embed this Wren script in the following C program, compile and run it.
<syntaxhighlight lang="c">#include/* <stdlibgcc Terminal_control_Dimensions.h>c -o Terminal_control_Dimensions -lwren -lm */
 
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Line 961 ⟶ 971:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "terminal_control_dimensionsTerminal_control_Dimensions.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
9,476

edits