Welcome to Neuridion!

The programming language for everyone.

Neuridion is a modern programming language designed for simplicity and clarity. Whether you're writing your very first program or building something amazing, Neuridion makes it easy to bring your ideas to life.

Did you know? Your Mac has a built-in AI that you can use right from Neuridion — no account or API key needed! Just use AI.Apple() and start asking questions. We'll show you how below.

Quick Start

Let's write your first Neuridion program — just one line!

Print("Hello, World!")

Now let's try something with variables and a loop:

Var name As String = "Neuridion"
Var version As Double = 2.0

Print("Welcome to " + name + " Version " + version.ToString())

For i = 1 To 5
    Print("Iteration: " + i.ToString())
End For
Running code: Write your code in the editor and hit the Play button (or press Cmd+R) to see it run!
🚀 Try it! — Ask your Mac a question
Your Mac has a built-in AI. Let's ask it something! (Requires Apple Silicon Mac with macOS 26+)
Var apple As Object = AI.Apple()
Var answer As String = apple.Generate("Why is the sky blue?")
Print(answer)

Variables & Types

Variables are declared with Var or Dim. A type annotation with As is required:

Var name As String = "Hello"
Var age As Integer = 25
Var price As Double = 19.99
Var active As Boolean = True
Var items As Array = [1, 2, 3]
Var empty As String = ""
Important: Every variable declaration must include a type annotation using As Type. Writing Var x = 5 without a type is not allowed.

Data Types

TypeDescriptionExample
StringText"Hello World"
IntegerWhole number42
DoubleDecimal number3.14
BooleanTruth valueTrue / False
ArrayList of values[1, 2, 3]
ObjectKey-value pairs (from JSON.Parse)JSON.Parse(...)
NilNo valueNil

Type Conversion

Var text As String = "42"
Var number As Integer = text.ToInteger()   // String -> Integer: 42
Var dec As Double = "3.14".ToDouble()      // String -> Double: 3.14
Var s As String = dec.ToString()              // Number -> String: "3.14"
🎯 Try it! — Play with variables
Create a few variables and let AI explain what they are:
Var name As String = "Neuridion"
Var year As Integer = 2026
Print("Welcome to " + name + " in " + year.ToString())

// Ask AI to explain what a variable is
Var apple As Object = AI.Apple()
Var explanation As String = apple.Generate("Explain what a variable is in programming, in one sentence.")
Print(explanation)

Operators

Arithmetic Operators

OperatorDescriptionExample
+Addition / String concatenation5 + 38
-Subtraction10 - 46
*Multiplication / String repetition"ha" * 3"hahaha"
/Division10 / 33.333...
\Integer division10 \ 33
ModRemainder (modulo)10 Mod 31
^Exponentiation2 ^ 8256

Comparison Operators

OperatorDescription
=Equal to
<>Not equal to
<Less than
<=Less than or equal to
>Greater than
>=Greater than or equal to

Logical Operators

Var a As Boolean = True And False   // False
Var b As Boolean = True Or False    // True
Var c As Boolean = Not True          // False
Var d As Boolean = True Xor False   // True

Updating Variables

Var x As Integer = 10
x = x + 5    // x is now 15
x = x - 3    // x is now 12
x = x * 2    // x is now 24
x = x / 4    // x is now 6

Comments

Use // to write comments. Everything after // on a line is ignored by the compiler:

// This is a comment
Var x As Integer = 42   // Inline comment after code

// You can use comments to explain your code
// or to temporarily disable lines:
// Print("This line won't run")
Note: Neuridion only supports single-line comments with //. There are no multi-line or block comments.

Integer

Integers are whole numbers (positive, negative, or zero) without a decimal point.

Var age As Integer = 25
Var negative As Integer = -10
Var big As Integer = 1000000

Integer Properties

Var n As Integer = 42

n.IsEven             // True
n.IsOdd              // False
7.IsEven             // False
7.IsOdd              // True

Integer Methods

Var n As Integer = -15

n.ToString()         // "-15" (converts to String)
n.ToDouble()         // -15.0 (converts to Double)
n.Abs()              // 15 (absolute value)
n.Clamp(0, 100)     // 0 (clamps between min and max)
50.Clamp(0, 100)    // 50
200.Clamp(0, 100)   // 100

Integer Arithmetic

Var a As Integer = 10
Var b As Integer = 3

a + b                // 13
a - b                // 7
a * b                // 30
a / b                // 3.333... (always returns Double)
a \ b                // 3 (integer division)
a Mod b              // 1 (remainder)
a ^ 2                // 100 (exponentiation)
Note: Neuridion has no compound assignment operators. Use x = x + 1 instead of x += 1.

Double

Doubles are decimal (floating-point) numbers for precise calculations.

Var pi As Double = 3.14159
Var temperature As Double = -12.5
Var scientific As Double = 1.5e10     // 15000000000.0

Double Methods

Var x As Double = 3.7

x.ToString()         // "3.7" (converts to String)
x.ToInteger()        // 3 (truncates decimal part)
x.Round()            // 4.0 (commercial rounding, DIN 1333)
x.Round(2)           // 3.7 (rounds to 2 decimal places)
x.RoundBankers()     // 4.0 (banker's rounding, IEEE 754)
x.Ceil()             // 4.0 (rounds up)
x.Floor()            // 3.0 (rounds down)
x.Abs()              // 3.7 (absolute value)

// Commercial rounding (Round Half Away from Zero)
// When digit is exactly 5, always rounds away from zero
Var price As Double = 19.99567
price.Round(2)       // 20.0  (2 decimal places)
price.Round(1)       // 20.0  (1 decimal place)
2.5.Round()          // 3.0  (5 rounds up)
3.5.Round()          // 4.0  (5 rounds up)
-2.5.Round()         // -3.0 (5 rounds away from zero)

// Banker's rounding (Round Half to Even)
// When digit is exactly 5, rounds to nearest even number
2.5.RoundBankers()   // 2.0  (rounds to even)
3.5.RoundBankers()   // 4.0  (rounds to even)

Var neg As Double = -2.3
neg.Abs()            // 2.3
neg.Round()          // -2.0
neg.Ceil()           // -2.0
neg.Floor()          // -3.0

// Clamp between a minimum and maximum
3.7.Clamp(0.0, 1.0) // 1.0
0.5.Clamp(0.0, 1.0) // 0.5
Note: Division with / always returns a Double, even for integers: 10 / 33.333.... Use \ for integer division: 10 \ 33.

Boolean

Booleans represent truth values: True or False. They are the result of comparisons and logical operations.

Var isActive As Boolean = True
Var isDone As Boolean = False
Var check As Boolean = 10 > 5       // True

Boolean Methods

Var flag As Boolean = True

flag.ToString()      // "True" (converts to String)
flag.ToInteger()     // 1 (True = 1, False = 0)

False.ToString()     // "False"
False.ToInteger()    // 0

Logical Operators

Var a As Boolean = True And False   // False (both must be True)
Var b As Boolean = True Or False    // True (at least one True)
Var c As Boolean = Not True          // False (inverts the value)
Var d As Boolean = True Xor False   // True (exactly one True)

Using Booleans in Control Flow

Var age As Integer = 18
Var hasLicense As Boolean = True

If age >= 18 And hasLicense Then
    Print("Can drive")
End If

// Toggle a boolean
Var light As Boolean = True
light = Not light   // False
light = Not light   // True

Strings

String Interpolation

Var name As String = "World"
Var age As Integer = 25
Print($"Hello {name}, you are {age} years old!")

String Methods

All string functions are called as methods on the string:

Var text As String = "  Hello World  "

// Length & Checks
text.Length              // 15
text.IsEmpty             // False
text.IsBlank             // False
"42".IsNumeric           // True
"hello".IsNumeric        // False
// Case Conversion
"hello".ToUppercase()    // "HELLO"
"HELLO".ToLowercase()    // "hello"

// Trimming
text.Trim()              // "Hello World"
text.TrimStart()         // "Hello World  "
text.TrimEnd()           // "  Hello World"

// Searching
"Hello World".Contains("World")    // True
"Hello World".IndexOf("World")     // 6
"Hello World".StartsWith("He")    // True
"Hello World".EndsWith("ld")      // True

// Extracting Parts
"Hello".Left(3)             // "Hel"
"Hello".Right(3)            // "llo"
"Hello World".SubString(6, 5) // "World"

// Modifying
"Hello World".Replace("World", "Earth")  // "Hello Earth"
"a,b,c".Split(",")                       // ["a", "b", "c"]
"Hello".Reverse()                        // "olleH"
"ha".Repeat(3)                            // "hahaha"

// Padding
"42".PadLeft(5, "0")     // "00042"
"Hi".PadRight(6, ".")    // "Hi...."

// Decomposition
"Hello".Chars              // ["H","e","l","l","o"]
"A\nB\nC".Lines             // ["A","B","C"]
"Hello World Test".Words   // ["Hello","World","Test"]

// Conversion
"42".ToInteger()            // 42
"3.14".ToDouble()           // 3.14
💬 Try it! — Let AI write a story for you
Combine strings and AI to create a personalized story:
Var hero As String = "Luna"
Var animal As String = "dragon"
Var prompt As String = "Write a 3-sentence story about " + hero + " and a friendly " + animal + "."

Var apple As Object = AI.Apple()
Var story As String = apple.GenerateWith(prompt, "You are a creative storyteller for kids.")
Print(story)

Arrays

Var numbers As Array = [1, 2, 3, 4, 5]
Var names As Array = ["Anna", "Ben", "Clara"]
Var empty As Array = []

// Access
Print(names[0])    // "Anna"
names[1] = "Bob"   // Change element

Array Methods

Var arr As Array = [3, 1, 4, 1, 5]

// Properties
arr.Count             // 5
arr.First             // 3
arr.Last              // 5
arr.IsEmpty           // False

// Adding & Removing
arr.Append(9)         // [3,1,4,1,5,9]
arr.Insert(0, 7)     // [7,3,1,4,1,5,9]
arr.Remove(0)         // Removes element at index 0
arr.Pop()             // Removes & returns last element
arr.Clear()           // Empties the array

// Searching
arr.Contains(4)       // True
arr.IndexOf(4)        // Index of 4

// Transformations
arr.Sort()            // Sorted ascending
arr.Reverse()         // Reversed
arr.Distinct()        // Duplicates removed
arr.Slice(1, 3)      // Sub-array
arr.Join(", ")        // "3, 1, 4, 1, 5"

// Math (for numeric arrays)
[1,2,3].Sum           // 6
[1,2,3].Average       // 2.0
[1,2,3].Min           // 1
[1,2,3].Max           // 3

Higher-Order Array Methods

For Map, Filter, Reduce, etc., you pass a named function:

Function double(x As Integer) As Integer
    Return x * 2
End Function

Function isEven(x As Integer) As Boolean
    Return x Mod 2 = 0
End Function

Function add(a As Integer, b As Integer) As Integer
    Return a + b
End Function

Var numbers As Array = [1, 2, 3, 4, 5]

Var doubled As Array = numbers.Map(double)        // [2, 4, 6, 8, 10]
Var evens As Array = numbers.Filter(isEven)       // [2, 4]
Var total As Integer = numbers.Reduce(0, add)    // 15
Var found As Integer = numbers.Find(isEven)       // 2
Var allEven As Boolean = numbers.Every(isEven)   // False
Var anyEven As Boolean = numbers.Any(isEven)     // True

Object

Objects are key-value collections (dictionaries). Keys are always strings, values can be any type. Use As Object to declare them.

// Create from JSON
Var person As Object = JSON.Parse("{\"name\": \"Anna\", \"age\": 25}")

// Access values
Print(person["name"])    // "Anna"
Print(person["age"])     // 25

// Set values
person["email"] = "anna@example.com"

Object Properties

Var data As Object = JSON.Parse("{\"x\": 10, \"y\": 20, \"z\": 30}")

data.Count           // 3 (number of key-value pairs)
data.Keys            // ["x", "y", "z"] (array of all keys, sorted)
data.Values          // [10, 20, 30] (array of all values)
data.IsEmpty         // False

Object Methods

Var config As Object = JSON.Parse("{\"host\": \"localhost\", \"port\": 8080}")

// Check if a key exists
config.ContainsKey("host")    // True
config.ContainsKey("timeout") // False

// Remove a key
config.Remove("port")         // Removes "port" entry
Print(config.Count)            // 1

// Clear all entries
config.Clear()
Print(config.IsEmpty)          // True

Iterating Over Objects

Var colors As Object = JSON.Parse("{\"red\": \"#FF0000\", \"green\": \"#00FF00\", \"blue\": \"#0000FF\"}")

// Loop over keys
For Each key In colors.Keys
    Print($"{key} = {colors[key]}")
End For

Objects from Standard Library

Many standard library functions return objects with properties and methods:

// Network response object
Var response As Object = Network.Get("https://api.example.com/data")
Print(response.StatusCode)   // 200
Print(response.Body)         // Response body text

// DateAndTime object
Var now As Object = DateAndTime.Now()
Print(now.Year)              // 2026
Print(now.Format("dd.MM.yyyy"))

// Form result object
Var win As Object = Form.Window("Login", 300, 200)
win.AddTextField("user", "", 20, 20, 260, {"Placeholder": "Username"})
Var result As Object = win.Show()
Print(result["user"])        // User input
Note: Always use As Object for key-value data. Dictionary is not a valid type name in Neuridion.

Control Flow

If / Then / Else

Var score As Integer = 85

If score >= 90 Then
    Print("Excellent!")
ElseIf score >= 70 Then
    Print("Good!")
Else
    Print("Keep practicing!")
End If

Select Case

Var day As String = "Monday"

Select Case day
    Case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"
        Print("Workday")
    Case "Saturday", "Sunday"
        Print("Weekend!")
    Case Else
        Print("Unknown day")
End Select

Loops

For / End For

For i = 1 To 10
    Print(i)
End For

// With step size
For i = 0 To 100 Step 10
    Print(i)
End For

// Counting backwards
For i = 10 To 1 Step -1
    Print(i)
End For

For Each

Var fruits As Array = ["Apple", "Banana", "Cherry"]

For Each fruit In fruits
    Print(fruit)
End For

While / End While

Var i As Integer = 0
While i < 5
    Print(i)
    i = i + 1
End While

Do / Loop

Var n As Integer = 1
Do
    Print(n)
    n = n * 2
Loop Until n > 100

Loop Control

For i = 1 To 10
    If i = 5 Then
        Break         // Exit the loop
    End If
    If i Mod 2 = 0 Then
        Continue      // Skip to next iteration
    End If
    Print(i)
End For
🎲 Try it! — A fun counting loop
Use a loop to build a countdown, then let AI tell you a fun fact about rockets:
For i = 5 To 1 Step -1
    Print(i.ToString() + "...")
End For
Print("Liftoff!")

// Ask AI for a fun space fact
Var apple As Object = AI.Apple()
Var fact As String = apple.Generate("Tell me one fun fact about rockets in one sentence.")
Print(fact)

Functions & Subs

Functions (with return value)

Function add(a As Integer, b As Integer) As Integer
    Return a + b
End Function

Var result As Integer = add(3, 7)  // 10

Subs (without return value)

Sub greet(name As String)
    Print("Hello, " + name + "!")
End Sub

greet("Anna")

Default Values

Function greeting(name As String = "World") As String
    Return "Hello, " + name + "!"
End Function

Print(greeting())          // "Hello, World!"
Print(greeting("Max"))    // "Hello, Max!"

Classes & Inheritance

Class Animal
    Var Name As String
    Var Age As Integer

    Sub Constructor(name As String, age As Integer)
        Me.Name = name
        Me.Age = age
    End Sub

    Function Info() As String
        Return Me.Name + " (" + Me.Age.ToString() + " years)"
    End Function
End Class

Class Dog Inherits Animal
    Var Breed As String

    Sub Constructor(name As String, age As Integer, breed As String)
        Super.Constructor(name, age)
        Me.Breed = breed
    End Sub

    Function Bark() As String
        Return Me.Name + " says: Woof!"
    End Function
End Class

Var rex As Dog = New Dog("Rex", 5, "German Shepherd")
Print(rex.Info())     // "Rex (5 years)"
Print(rex.Bark())     // "Rex says: Woof!"
Note: Neuridion does not use access modifiers like Public, Private, or Protected. All members are accessible.

Error Handling

Try
    Var content As String = FileAndFolder.ReadFile("/path/to/file.txt")
    Print(content)
Catch error
    Print("Error: " + error)
Finally
    Print("Done.")
End Try
// Throwing custom errors
Function divide(a As Double, b As Double) As Double
    If b = 0 Then
        Throw "Division by zero!"
    End If
    Return a / b
End Function

Import & Multiple Files

As your project grows, you can split code into multiple .code files. Use the Import statement to load code from other files. All functions, subs, classes, and variables defined in the imported file become available in the importing file.

Basic Import

// Main.code
Import "Helper.code"

// Now you can use functions from Helper.code
Var result As Integer = Add(5, 3)
Print(result)   // 8
// Helper.code
Function Add(a As Integer, b As Integer) As Integer
    Return a + b
End Function

Function Multiply(a As Integer, b As Integer) As Integer
    Return a * b
End Function

Importing from Subfolders

You can organize files in subfolders. Use a relative path or dot-notation:

// Path notation
Import "Utils/MathHelper.code"

// Dot notation (equivalent)
Import Utils.MathHelper

Dot notation automatically converts dots to folder separators and appends .code. So Import Forms.Dialog loads Forms/Dialog.code.

How Import Works

Complete Example

// Main.code — Entry point
Import "Models.code"
Import "Utils.code"

Var user As Object = New User("Alice", 30)
Print(FormatUser(user))
// Models.code — Class definitions
Class User
    Var Name As String
    Var Age As Integer
    Sub Constructor(name As String, age As Integer)
        Me.Name = name
        Me.Age = age
    End Sub
End Class
// Utils.code — Helper functions
Function FormatUser(user As Object) As String
    Return $"{user.Name} (age {user.Age})"
End Function
Tip: The IDE automatically saves all open files before running your program, so you don’t need to manually save each file. If a runtime error occurs in an imported file, the IDE will automatically switch to that file and highlight the error line.

Global Functions

FunctionDescriptionExample
Print(value)Output to the consolePrint("Hello")
Print(a, b, ...)Multiple values with spacesPrint("Hello", name)
.ToString()Value to String(42).ToString()"42"
TypeOf(value)Type as StringTypeOf(42)"Integer"
Array(a, b, ...)Creates an ArrayArray(1, 2, 3)
IsNil(value)Checks if NilIsNil(x)
Note: Math functions like Abs, Min, Max, Sqrt, Round, and Random are not available as global functions. Use the Math module instead (e.g. Math.Abs(-5)). Dialog functions like InputBox and MsgBox are available through the Form module (e.g. Form.InputBox("Name?")).

Math Module

// Constants
Math.PI           // 3.14159265...
Math.E            // 2.71828182...
Math.Infinity     // Infinity
Math.NaN          // Not a Number

// Basic Functions
Math.Abs(-5)          // 5
Math.Sqrt(16)         // 4.0
Math.Pow(2, 10)       // 1024.0
Math.Min(3, 7)        // 3
Math.Max(3, 7)        // 7
Math.Sign(-42)        // -1

// Rounding (commercial rounding by default, DIN 1333)
Math.Round(3.6)       // 4
Math.Round(2.5)       // 3 (5 rounds up)
Math.Round(3.14159, 2) // 3.14 (round to 2 decimal places)
Math.RoundBankers(2.5) // 2 (banker's rounding: 5 rounds to even)
Math.Floor(3.9)       // 3
Math.Ceil(3.1)        // 4

// Trigonometry
Math.Sin(0)           // 0.0
Math.Cos(0)           // 1.0
Math.Tan(0)           // 0.0

// Logarithms
Math.Log(1)           // 0.0 (natural)
Math.Log10(100)       // 2.0
Math.Exp(1)           // 2.71828...

// Random
Math.Random()          // 0.0 to 1.0
Math.RandomInt(1, 6)  // 1 to 6

Console Module

Console.Write("Text without newline")
Console.WriteLine("Text with newline")
Console.Error("Error message")
Console.Warn("Warning")
Console.Info("Information")
Console.Debug("Debug output")

// Print a table
Var data As Array = JSON.Parse("[{\"Name\": \"Max\", \"Age\": 30}, {\"Name\": \"Anna\", \"Age\": 25}]")
Console.Table(data)

// Input
Var input As String = Console.ReadLine()

// Clear console
Console.Clear()

Crypto Module

Modern cryptography powered by Apple CryptoKit. Provides hashing, HMAC authentication, AES-GCM and ChaCha20-Poly1305 encryption, and secure random generation.

Hashing (SHA)

Var hash As String = Crypto.SHA256("Hello World")     // 64 hex chars
Var h384 As String = Crypto.SHA384("Hello World")     // 96 hex chars
Var h512 As String = Crypto.SHA512("Hello World")     // 128 hex chars

// Hash a file
Var fileHash As String = Crypto.HashFile("/path/file.txt")

HMAC (Message Authentication)

Var mac As String = Crypto.HMAC_SHA256("message", "secret-key")
Var mac512 As String = Crypto.HMAC_SHA512("message", "secret-key")

// Verify HMAC
Var valid As Boolean = Crypto.VerifyHMAC("message", "secret-key", mac)

AES-GCM Encryption

// Generate a 256-bit key (64 hex chars)
Var key As String = Crypto.GenerateKey()

// Encrypt → hex string (nonce + ciphertext + tag)
Var encrypted As String = Crypto.Encrypt("Secret data", key)

// Decrypt → original plaintext
Var decrypted As String = Crypto.Decrypt(encrypted, key)

ChaCha20-Poly1305 Encryption

// Alternative encryption algorithm (same key format)
Var enc As String = Crypto.EncryptChaCha("Secret data", key)
Var dec As String = Crypto.DecryptChaCha(enc, key)

Secure Random

// Random token (hex string, default 32 bytes)
Var token As String = Crypto.RandomToken(16)   // 16 bytes = 32 hex chars
MethodParametersReturns
SHA256(text)StringHex string (64 chars)
SHA384(text)StringHex string (96 chars)
SHA512(text)StringHex string (128 chars)
HashFile(path)File pathSHA256 hex of file
HMAC_SHA256(msg, key)Message, KeyHex string
HMAC_SHA512(msg, key)Message, KeyHex string
VerifyHMAC(msg, key, hex)Message, Key, ExpectedBoolean
GenerateKey()256-bit hex key
Encrypt(text, key)Plaintext, Key hexCombined hex
Decrypt(hex, key)Combined hex, Key hexPlaintext string
EncryptChaCha(text, key)Plaintext, Key hexCombined hex
DecryptChaCha(hex, key)Combined hex, Key hexPlaintext string
RandomToken(bytes)Byte countHex string

FileAndFolder Module

File Operations

// Read & Write
Var content As String = FileAndFolder.ReadFile("/path/file.txt")
FileAndFolder.WriteFile("/path/file.txt", "New content")
FileAndFolder.AppendLine("/path/log.txt", "New line")

// Check & Manage
FileAndFolder.FileExists("/path/file.txt")     // True/False
FileAndFolder.DeleteFile("/path/file.txt")
FileAndFolder.CopyFile("/from.txt", "/to.txt")
FileAndFolder.MoveFile("/old.txt", "/new.txt")
FileAndFolder.RenameFile("/path/old.txt", "new.txt")
FileAndFolder.GetFileSize("/path/file.txt")     // Bytes

Folder Operations

FileAndFolder.CreateFolder("/path/new_folder")
FileAndFolder.DeleteFolder("/path/folder")
FileAndFolder.FolderExists("/path/folder")

// List contents
Var files As Array = FileAndFolder.ListFiles("/path")
Var folders As Array = FileAndFolder.ListFolders("/path")
Var all As Array = FileAndFolder.ListAll("/path")

Path Helpers

FileAndFolder.GetFileName("/path/file.txt")     // "file.txt"
FileAndFolder.GetExtension("/path/file.txt")    // "txt"
FileAndFolder.GetDirectory("/path/file.txt")    // "/path"
FileAndFolder.Combine("/path", "file.txt")      // "/path/file.txt"
FileAndFolder.HomeDirectory                       // Home directory (property)
FileAndFolder.TempDirectory                       // Temp directory (property)
FileAndFolder.DesktopDirectory                    // Desktop directory (property)
FileAndFolder.DocumentsDirectory                  // Documents directory (property)
FileAndFolder.DownloadsDirectory                  // Downloads directory (property)
FileAndFolder.CurrentDirectory                    // Working directory (property)

FileHandle (Open)

Var handle As Object = FileAndFolder.Open("/path/file.txt")

// Properties
handle.Path                   // File path
handle.IsOpen                 // True/False

// Read entire file
Var text As String = handle.ReadAll()

// Read line by line
Var line As String = handle.ReadLine()   // Nil when done

// Write & Append
handle.Write("new content")             // Overwrites file
handle.Append("more text")              // Appends to end

// Close
handle.Close()

DateAndTime Module

DateAndTime methods return Date objects with properties and methods.

Creating Dates

Var now As Object = DateAndTime.Now()                      // Current date & time
Var today As Object = DateAndTime.Today()                  // Today at midnight
Var d As Object = DateAndTime.Create(2026, 3, 15)          // March 15, 2026
Var d2 As Object = DateAndTime.Create(2026, 3, 15, 10, 30) // With time
Var parsed As Object = DateAndTime.Parse("03/15/2026", "MM/dd/yyyy")

Date Properties

Var d As Object = DateAndTime.Now()

d.Year              // 2026
d.Month             // 2
d.Day               // 14
d.Hour              // 14
d.Minute            // 30
d.Second            // 0
d.DayOfWeek         // 7 (1=Sunday)
d.DayOfWeekName     // "Saturday"
d.MonthName         // "February"

Date Methods

// Manipulation (returns new Date object)
Var next As Object = d.AddDays(7)      // +7 days
d.AddHours(3)                          // +3 hours
d.AddMinutes(30)                       // +30 minutes
d.AddSeconds(90)                       // +90 seconds
d.AddMonths(2)                         // +2 months
d.AddYears(1)                          // +1 year

// Formatting
d.Format("dd.MM.yyyy")               // "14.02.2026"
d.Format("EEEE, MMMM d")             // "Saturday, February 14"
d.ToString()                           // "2026-02-14 14:30:00"

Calculating & Utilities

Var d1 As Object = DateAndTime.Create(2026, 1, 1)
Var d2 As Object = DateAndTime.Create(2026, 3, 15)

DateAndTime.DaysBetween(d1, d2)     // 73
DateAndTime.SecondsBetween(d1, d2)  // 6307200

DateAndTime.Timestamp()             // Unix timestamp (seconds)
DateAndTime.TimestampMillis()       // Unix timestamp (milliseconds)
DateAndTime.IsLeapYear(2028)        // True
DateAndTime.DaysInMonth(2026, 2)    // 28

JSON Module

// Parsing
Var text As String = "{\"name\": \"Max\", \"age\": 30}"
Var obj As Object = JSON.Parse(text)
Print(obj["name"])    // "Max"

// Serializing
Var json As String = JSON.Stringify(obj)               // Compact
Var jsonPretty As String = JSON.Stringify(obj, True)  // Pretty-printed

// Validating
JSON.IsValid("{\"ok\": true}")  // True
JSON.IsValid("not json")      // False

// Formatting
JSON.Format("{\"a\":1,\"b\":2}")  // Pretty-printed

// File read/write
Var config As Object = JSON.ReadFile("/path/config.json")
JSON.WriteFile("/path/output.json", obj, True)
Note: Objects with key-value pairs are created with {"key": "value"} literals or by parsing JSON strings with JSON.Parse().

Database Module

// Open database (SQLite) — returns a connection object
Var db As Object = Database.Open("/path/mydb.db")

// Or in memory
Var db As Object = Database.InMemory()

// Create table
db.Execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)")

// Insert data
db.Execute("INSERT INTO users (name, age) VALUES ('Max', 30)")
db.Execute("INSERT INTO users (name, age) VALUES ('Anna', 25)")

// Query
Var results As Array = db.Query("SELECT * FROM users")
For Each row In results
    Print(row["name"] + ": " + row["age"].ToString())
End For

// Single value
Var count As Integer = db.Scalar("SELECT COUNT(*) FROM users")

// Helper functions
db.TableExists("users")      // True
db.LastInsertId()             // Last inserted ID
db.Changes()                  // Affected rows
db.Close()

Network Module

HTTP methods return a Response object with StatusCode, Body, OK, and Headers properties.

HTTP Requests

// GET request - returns Response object
Var response As Object = Network.Get("https://api.example.com/data")
response.StatusCode          // 200
response.Body                // Response text
response.OK                  // True (200-299)
response.Headers             // Object with header key-value pairs

// POST request
Var body As String = JSON.Stringify(JSON.Parse("{\"name\": \"Max\"}"))
Var result As Object = Network.Post("https://api.example.com/users", body)

// PUT & DELETE
Network.Put("https://api.example.com/users/1", body)
Network.Delete("https://api.example.com/users/1")

// Download file
Network.Download("https://example.com/image.png", "/path/image.png")

Session (Persistent Headers)

Var session As Object = Network.Session()
session.SetHeader("Authorization", "Bearer token123")
session.SetHeader("Accept", "application/json")

// All requests include persistent headers
Var r As Object = session.Get("https://api.example.com/me")
session.Post("https://api.example.com/data", body)
session.RemoveHeader("Accept")

RegEx Module

// Check if pattern matches
RegEx.IsMatch("hello123", "[a-z]+\\d+")  // True

// Find first match
Var match As String = RegEx.Match("Price: 42 Euro", "\\d+")
Print(match)   // "42"

// Replace
Var result As String = RegEx.Replace("Hello World", "\\s", "-")
Print(result)   // "Hello-World"

// Split
Var parts As Array = RegEx.Split("a1b2c3", "\\d")
// ["a", "b", "c"]

// Escape special characters
Var safe As String = RegEx.Escape("(test)")  // "\\(test\\)"

System Module

// Wait
System.Sleep(1000)              // Wait 1 second

// Exit program
System.Exit(0)

// Environment variables
Var home As String = System.Environment("HOME")

// System info
System.Platform                  // "macOS"
System.OSVersion                 // Operating system version
System.UserName                  // Username
System.CurrentTimeMillis()       // Milliseconds since epoch

Color Module

Creating Colors

// From RGB values (0-255)
Var red As Object = Color.RGB(255, 0, 0)

// With alpha transparency (0.0-1.0)
Var semiTransparent As Object = Color.RGBA(255, 0, 0, 0.5)

// From hex string
Var blue As Object = Color.Hex("#0000FF")
Var green As Object = Color.Hex("0F0")       // Short form

// From HSL values (Hue 0-360, Saturation 0-100, Lightness 0-100)
Var color As Object = Color.HSL(200, 80, 50)

Color Properties

Var c As Object = Color.RGB(100, 150, 200)
Print(c.Red)       // 100
Print(c.Green)     // 150
Print(c.Blue)      // 200
Print(c.Alpha)     // 1.0
Print(c.Hex)       // "#6496C8"
Print(c.ToString())// "Color(100, 150, 200)"

Named Colors

Color.Red       Color.Green      Color.Blue
Color.White     Color.Black      Color.Yellow
Color.Orange    Color.Purple     Color.Cyan
Color.Magenta   Color.Gray       Color.Pink
Color.Gold      Color.Silver     Color.Navy
Color.Teal      Color.Coral      Color.Brown
Color.LightGray Color.DarkGray

Color Manipulation

// Mix two colors
Var mix As Object = Color.Mix(Color.Red, Color.Blue)

// Lighten (0.0 = no change, 1.0 = white)
Var light As Object = Color.Lighten(Color.Blue, 0.3)

// Darken (0.0 = no change, 1.0 = black)
Var dark As Object = Color.Darken(Color.Red, 0.5)

Form Module

The Form module lets you create windows, dialogs, and user interfaces from code. All 14 control types use a unified signature: Add*(name, content, x, y, width [, {options}]).

Form.Window(title, width, height [, windowType])

Creates a new window object. The optional 4th argument sets the window type.

// Basic window
Var win As Object = Form.Window("My App", 400, 300)

// Window types: "Standard" (default), "Dialog", "Utility", "FullScreen"
Var dialog As Object = Form.Window("Settings", 300, 200, "Dialog")
Var tools As Object = Form.Window("Tools", 250, 400, "Utility")

Window Properties

All properties can be set after creation, before calling Show():

PropertyTypeDefaultDescription
TitleStringfrom constructorWindow title
Width, HeightDoublefrom constructorWindow dimensions in pixels
X, YDoublecenteredPosition on screen (from top-left corner). If not set, the window is centered
BackgroundColorColorsystem defaultBackground color (use Color.RGB() or a named color)
OpacityDouble1.0Window transparency (0.0 = invisible, 1.0 = opaque)
AlwaysOnTopBooleanFalseKeep window above all other windows
MovableBooleanTrueWhether the window can be dragged
ResizableBooleanTrueWhether the window can be resized
MinimizableBooleanTrueWhether the minimize button is active
CloseButtonBooleanTrueWhether the close button is shown
Var win As Object = Form.Window("Overlay", 300, 150)
win.BackgroundColor = Color.RGB(30, 30, 40)
win.Opacity = 0.9
win.X = 100
win.Y = 100
win.AlwaysOnTop = True
win.Resizable = False
win.Movable = False

Unified Control Signature

All controls (except Separator) use the same signature: Add*(name, content, x, y, width [, {options}]). The content parameter is the 2nd argument and its meaning depends on the control type. All methods accept an optional trailing options object for Height overrides and type-specific settings.

AddLabel(name, text, x, y, width [, {options}])

Adds a text label.

OptionTypeDefaultDescription
HeightDouble22Height in pixels
FontSizeDouble13Font size
FontBoldBooleanFalseBold text
win.AddLabel("lblUser", "Username:", 20, 20, 200)

// Large bold title
win.AddLabel("title", "Welcome!", 20, 10, 300, {"FontSize": 18, "FontBold": True})

AddButton(name, text, x, y, width [, {options}])

Adds a button. Clicking a button closes the window. The clicked button's text is stored in result["_clickedButton"].

OptionTypeDefaultDescription
StyleString"Standard"Button style (see below)
HeightDouble32Height in pixels

Button Styles:

StyleDescription
"Standard"Normal button (default)
"Primary"Highlighted accent button (responds to Enter key)
"Destructive"Red button for dangerous actions
"Link"Borderless text link
win.AddButton("btnSave", "Save", 20, 220, 120, {"Style": "Primary"})
win.AddButton("btnCancel", "Cancel", 150, 220, 120)
win.AddButton("btnDelete", "Delete", 280, 220, 120, {"Style": "Destructive"})

AddTextField(name, default, x, y, width [, {options}])

Adds a single-line text input. The default parameter sets the initial value. Returns the entered text in result[name].

OptionTypeDefaultDescription
PlaceholderString""Placeholder text (shown when empty)
HeightDouble28Height in pixels
FontSizeDouble13Font size
EnabledBooleanTrueWhether the field is editable
win.AddTextField("email", "", 20, 50, 300, {"Placeholder": "you@example.com"})

// Pre-filled value
win.AddTextField("city", "Berlin", 20, 90, 300)

AddTextArea(name, text, x, y, width [, {options}])

Adds a multi-line text area with scroll support. Returns the text content in result[name].

OptionTypeDefaultDescription
HeightDouble100Height in pixels
FontSizeDouble13Font size
EnabledBooleanTrueWhether the area is editable
win.AddTextArea("notes", "Enter notes...", 20, 50, 360, {"Height": 120})

AddCheckBox(name, label, x, y, width [, {options}])

Adds a checkbox. Returns True/False in result[name].

OptionTypeDefaultDescription
HeightDouble22Height in pixels
CheckedBooleanFalseInitial checked state
win.AddCheckBox("accept", "I accept the terms", 20, 160, 250)
win.AddCheckBox("news", "Subscribe to newsletter", 20, 190, 250, {"Checked": True})

AddRadioButton(name, label, x, y, width [, {options}])

Adds a radio button. Returns True/False in result[name].

OptionTypeDefaultDescription
HeightDouble22Height in pixels
SelectedBooleanFalseInitial selected state
win.AddRadioButton("optLight", "Light Mode", 20, 50, 200, {"Selected": True})
win.AddRadioButton("optDark", "Dark Mode", 20, 75, 200)

AddComboBox(name, items, x, y, width [, {options}])

Adds a dropdown combo box. The items parameter is an array of strings. Returns the selected item text in result[name].

OptionTypeDefaultDescription
HeightDouble28Height in pixels
win.AddComboBox("role", ["User", "Admin", "Guest"], 20, 50, 200)

AddListBox(name, items, x, y, width [, {options}])

Adds a scrollable list. The items parameter is an array of strings. Returns the selected index in result[name] (-1 if none selected).

OptionTypeDefaultDescription
HeightDouble120Height in pixels
win.AddListBox("colors", ["Red", "Green", "Blue", "Yellow"], 20, 50, 200)

AddSlider(name, value, x, y, width [, {options}])

Adds a slider control. The value sets the initial position. Returns the current value as Double in result[name].

OptionTypeDefaultDescription
MinDouble0Minimum value
MaxDouble100Maximum value
HeightDouble22Height in pixels
win.AddSlider("volume", 75, 20, 50, 250)
win.AddSlider("temp", 20, 20, 90, 250, {"Min": -10, "Max": 40})

AddProgressBar(name, value, x, y, width [, {options}])

Adds a progress bar (display only, not collected in results). The value sets the progress (0-100).

OptionTypeDefaultDescription
HeightDouble20Height in pixels
win.AddProgressBar("progress", 65, 20, 50, 300)

AddImageView(name, path, x, y, width [, {options}])

Adds an image display area. The path is the file path to the image.

OptionTypeDefaultDescription
HeightDouble100Height in pixels
ScaleToFitBooleanTrueScale image to fit the view
win.AddImageView("photo", "/Users/me/photo.jpg", 20, 50, 200, {"Height": 150})

AddGroupBox(name, title, x, y, width [, {options}])

Adds a titled group box for visual grouping of controls.

OptionTypeDefaultDescription
HeightDouble150Height in pixels
win.AddGroupBox("grpAccount", "Account Settings", 20, 50, 360, {"Height": 120})

AddSeparator(name, x, y, width [, {options}])

Adds a horizontal separator line. This is the only control without a content parameter.

OptionTypeDefaultDescription
HeightDouble2Height in pixels
win.AddSeparator("sep1", 20, 140, 360)

AddTable(name, data, x, y, width [, {options}])

Adds a multi-column table view. The data parameter is a 2D array. By default, the first row is used as column headers.

OptionTypeDefaultDescription
HasHeadersBooleanTrueFirst row is used as column headers
HasColumnWidthsArrayautoColumn widths, e.g. [100, 200, 80]
EditableBooleanFalseWhether cells are editable
HeightDouble200Height in pixels

If Editable is True, the modified 2D array is returned in result[name].

Var data As Array = [
    ["Name", "Age", "City"],
    ["Alice", "30", "Berlin"],
    ["Bob", "25", "Munich"]
]
win.AddTable("users", data, 20, 50, 360)

// Editable table with custom column widths
win.AddTable("config", data, 20, 260, 360, {"Editable": True, "HasColumnWidths": [150, 80, 130]})

Show()

Displays the window modally and waits for the user to click a button or close the window. Returns an object with all control values:

ControlResult typeDescription
TextFieldStringEntered text
TextAreaStringMulti-line text content
CheckBoxBooleanChecked state
RadioButtonBooleanSelected state
ComboBoxStringSelected item text
ListBoxIntegerSelected index (-1 if none)
SliderDoubleCurrent value
Table (Editable)Array2D array of current data
_clickedButtonStringText of clicked button
_clickedIndexIntegerIndex of clicked button

Setting Properties After Creation

All control properties can also be set after creation, before calling Show():

Var field As Object = win.AddTextField("email", "", 20, 50, 300)
field.Text = "max@example.com"
field.Placeholder = "E-Mail address"
field.FontSize = 15
field.Enabled = False

Event Loop Mode

For interactive forms that respond to events while staying open, use Open() + WaitForEvent() + Close() instead of Show():

Var win As Object = Form.Window("Counter", 300, 180)
win.AddLabel("lblCount", "Count: 0", 20, 20, 260)
win.AddButton("btnUp", "+1", 20, 55, 80, {"Style": "Primary"})
win.AddButton("btnDown", "-1", 110, 55, 80)
win.AddButton("btnClose", "Close", 20, 100, 80)
win.Open()

Var count As Integer = 0
While True
    Var ev As Object = win.WaitForEvent()
    Select Case ev["_control"]
        Case "btnUp"
            count = count + 1
            Var ctl As Object = win.GetControl("lblCount")
            ctl.Text = "Count: " + count.ToString()
        Case "btnDown"
            count = count - 1
            Var ctl As Object = win.GetControl("lblCount")
            ctl.Text = "Count: " + count.ToString()
        Case "btnClose"
            Exit While
        Case "_window"
            Exit While
    End Select
End While
win.Close()

Event Object

WaitForEvent() blocks until the user interacts with the form. It returns an object with these keys:

KeyTypeDescription
_eventString"click", "change", or "close"
_controlStringControl name (e.g. "btnUp"), or "_window" for close button
_valuevariesCurrent value of the triggering control
_typeStringControl type ("Button", "ComboBox", etc.)
(field names)variesAll current form field values (same as Show() returns)

Events by Control Type

ControlEventTrigger
ButtonclickButton clicked
CheckBoxchangeToggled
RadioButtonchangeSelected
ComboBoxchangeSelection changed
ListBoxchangeSelection changed
SliderchangeValue moved
TextFieldchangeEnter key or focus lost
TextAreachangeFocus lost
Window X buttoncloseWindow closed by user

GetControl() — Live Properties

win.GetControl(name) returns a control object whose properties update the NSView immediately when set:

Var ctl As Object = win.GetControl("name")
ctl.Text = "new text"       // updates the control
ctl.Enabled = False          // disables the control
ctl.Visible = False          // hides the control
ctl.Value = 75               // slider/progress value
ctl.Items = ["A", "B", "C"] // update combo/list items

Available properties: Text, Enabled, Visible, Value, Items, Placeholder, FontSize, FontBold.

Form.InputBox(prompt [, title [, defaultValue]])

Shows a simple input dialog. Returns the entered text as String, or "" if cancelled.

// Simple prompt
Var name As String = Form.InputBox("What is your name?")

// With custom title and default value
Var host As String = Form.InputBox("Enter hostname:", "Connection", "localhost")

Form.MsgBox(message [, title [, style]])

Shows a message dialog. Returns an Integer indicating which button was clicked.

StyleButtonsReturn values
0 (default)OK1 = OK
1OK / Cancel1 = OK, 2 = Cancel
4Yes / No6 = Yes, 7 = No
3Yes / No / Cancel6 = Yes, 7 = No, 2 = Cancel
// Simple message
Form.MsgBox("File saved successfully!")

// Confirmation with Yes/No
Var answer As Integer = Form.MsgBox("Delete this file?", "Confirm", 4)
If answer = 6 Then
    Print("User clicked Yes")
End If

Complete Example

Var win As Object = Form.Window("User Profile", 420, 380)

// Title
win.AddLabel("header", "Edit Profile", 20, 15, 380, {"FontSize": 18, "FontBold": True})
win.AddSeparator("sep1", 20, 42, 380)

// Text fields
win.AddLabel("lblName", "Name:", 20, 55, 200)
win.AddTextField("name", "", 20, 78, 380, {"Placeholder": "Your full name"})

win.AddLabel("lblEmail", "E-Mail:", 20, 115, 200)
win.AddTextField("email", "user@example.com", 20, 138, 380)

// Role selection
win.AddLabel("lblRole", "Role:", 20, 175, 100)
win.AddComboBox("role", ["User", "Admin", "Moderator"], 20, 200, 200)

// Options
win.AddCheckBox("newsletter", "Subscribe to newsletter", 20, 240, 300, {"Checked": True})

// Volume slider
win.AddLabel("lblVol", "Notifications:", 20, 275, 150)
win.AddSlider("volume", 75, 20, 300, 250)

// Buttons
win.AddButton("btnSave", "Save", 20, 340, 120, {"Style": "Primary"})
win.AddButton("btnCancel", "Cancel", 150, 340, 120)

Var result As Object = win.Show()

If result["_clickedButton"] = "Save" Then
    Print($"Name: {result["name"]}")
    Print($"Email: {result["email"]}")
    Print($"Role: {result["role"]}")
    Print($"Volume: {result["volume"]}")
End If
Tip: When your code contains Form.Window(), a Code/Form toggle appears in the tab bar. Click Form to see a visual preview of your form layout.

XML Module

Parse, navigate, and create XML documents.

Loading & Parsing

// Load from file
Var doc As Object = XML.LoadFromFile("/path/data.xml")

// Parse from string
Var doc2 As Object = XML.ParseString("<root><item>Hello</item></root>")

// Save & convert
doc.SaveToFile("/path/output.xml")
Var xmlText As String = doc.ToString()

Navigating

Var root As Object = doc.GetRootElement()
root.Name                              // Element name
root.TextContent                       // Text between tags

Var children As Array = root.GetChildren()
Var child As Object = root.GetChildByName("item")

// Read attributes & text
Var id As String = child.GetAttribute("id")
Var text As String = child.GetTextContent()

Creating & Modifying

// Create elements
Var el As Object = XML.CreateElement("person")
Var name As Object = XML.CreateElement("name", "Alice")

// Build tree
el.AddChild(name)
el.SetAttribute("id", "1")
el.SetTextContent("new text")
el.RemoveChild("name")

// Create document from root element
Var newDoc As Object = XML.CreateDocument(el)

Audio Module

Play audio files and record from the microphone.

Playback

// Load a sound file
Var player As Object = Audio.LoadSound("/path/sound.mp3")

// Controls
player.Play()                  // Start from beginning
player.Pause()                 // Pause
player.Resume()                // Continue
player.Stop()                  // Stop and reset
player.Seek(30.5)              // Jump to 30.5 seconds

// Settings
player.SetVolume(75)           // 0-100
player.SetLooping(True)        // Loop forever

// Info
player.GetDuration()           // Total length (seconds)
player.GetPosition()           // Current position (seconds)
player.Duration                // Duration property
player.IsPlaying               // True/False

// Free resources
player.Release()

Recording

// Start recording (saves as M4A)
Var rec As Object = Audio.StartRecording("/path/recording.m4a")
rec.IsRecording                // True

// Monitor input level (0.0 to 1.0)
Var level As Double = rec.GetInputLevel()

// Stop and get file path
Var path As String = rec.StopRecording()

Compression Module

ZIP archives and in-memory data compression.

ZIP Archives

// Compress a folder to ZIP
Compression.ZipFolder("/path/folder", "/path/archive.zip")

// Add a single file to ZIP
Compression.ZipFile("/path/file.txt", "/path/archive.zip")

// Extract entire archive
Compression.Unzip("/path/archive.zip", "/path/output/")

// Extract a single file
Compression.UnzipFile("/path/archive.zip", "file.txt", "/path/output/")

// List archive contents
Var files As Array = Compression.ListArchiveContent("/path/archive.zip")

In-Memory Compression

// Compress text to Base64 (default: zlib)
Var compressed As String = Compression.CompressBytes("Hello World")

// Decompress back to text
Var original As String = Compression.DecompressBytes(compressed)

// Algorithms: "zlib" (default), "lz4", "lzfse", "lzma"
Var fast As String = Compression.CompressBytes(text, "lz4")
Var small As String = Compression.CompressBytes(text, "lzma")

Graphics Module

The Graphics module provides image creation, drawing, and manipulation through Picture objects. Pictures can be loaded from files or created programmatically.

Image Filters

Apply Core Image filters to any Picture object using ApplyFilter:

Var pic As Object = Graphics.LoadPicture("/path/photo.png")

// Gaussian blur (intensity 0-100)
pic.ApplyFilter("Blur", 5)

// Sepia tone (intensity 0.0-1.0)
pic.ApplyFilter("Sepia", 0.8)

// Black & white film effect
pic.ApplyFilter("Noir")

// Vivid chrome effect
pic.ApplyFilter("Chrome")

// Invert all colors
pic.ApplyFilter("Invert")

// Sharpen (intensity 0-100)
pic.ApplyFilter("Sharpen", 2.0)

// Dark edges vignette (intensity 0-10)
pic.ApplyFilter("Vignette", 1.0)

// Soft glow bloom (intensity 0-10)
pic.ApplyFilter("Bloom", 1.0)

// Pixel mosaic (pixel size)
pic.ApplyFilter("Pixellate", 8)

Resize & Crop

// Resize to new dimensions
pic.Resize(800, 600)

// Crop a region (x, y, width, height)
pic.Crop(50, 50, 200, 150)

Available Filters

FilterParameterDescription
"Blur"Radius (0-100)Gaussian blur
"Sepia"Intensity (0.0-1.0)Warm sepia tone
"Noir"NoneBlack & white film
"Chrome"NoneVivid chrome look
"Invert"NoneInvert colors
"Sharpen"Sharpness (0-100)Sharpen edges
"Vignette"Intensity (0-10)Dark edges
"Bloom"Intensity (0-10)Soft glow effect
"Pixellate"Scale (pixel size)Pixelation mosaic
🎨 Try it! — Draw a picture and let AI describe it
Create an image with shapes, then use AI Vision to see what it looks like:
Var pic As Object = Graphics.CreatePicture(400, 300)
pic.SetFillColor(30, 144, 255)
pic.FillRectangle(0, 0, 400, 300)
pic.SetFillColor(255, 255, 0)
pic.FillEllipse(150, 20, 100, 100)
pic.SetFillColor(0, 128, 0)
pic.FillRectangle(0, 200, 400, 100)
pic.Show()

// Let AI describe what it sees
Var labels As Array = pic.ClassifyImage()
For Each label In labels
    Print(label.Label + ": " + label.Confidence.ToString())
End For

Speech Module

Text-to-speech synthesis using the system's built-in voices. The Say method blocks until speech is finished.

// Speak text (waits until done)
Speech.Say("Hello, World!")

// Speak in a specific language
Speech.Say("Guten Tag!", "de-DE")

// Get available voices (Array of "lang: Name")
Var voices As Array = Speech.GetVoices()
For Each v In voices
    Print(v)
End For

// Set default voice by language code
Speech.SetVoice("en-US")

// Set speech rate (0-100, default 50)
Speech.SetRate(50)

// Set volume (0-100)
Speech.SetVolume(100)

// Check if currently speaking
Var speaking As Boolean = Speech.IsSpeaking()

// Stop speech immediately
Speech.Stop()

Methods

MethodDescription
Speech.Say(text)Speak text using the default voice, blocks until done
Speech.Say(text, lang)Speak text in a specific language (e.g. "de-DE")
Speech.GetVoices()Returns an Array of available voices as "lang: Name"
Speech.SetVoice(lang)Set the default voice by language code
Speech.SetRate(rate)Set speech rate (0-100, default 50)
Speech.SetVolume(vol)Set volume (0-100)
Speech.IsSpeaking()Returns True if speech is in progress
Speech.Stop()Stop speaking immediately

Clipboard Module

Read and write the system clipboard (pasteboard).

// Read text from clipboard
Var text As String = Clipboard.GetText()

// Write text to clipboard (returns True on success)
Var ok As Boolean = Clipboard.SetText("Copied!")

// Check if text is available on the clipboard
If Clipboard.HasText() Then
    Print("Clipboard has text: " + Clipboard.GetText())
End If

// Clear the clipboard
Clipboard.Clear()

Methods

MethodReturnsDescription
Clipboard.GetText()StringRead text from the clipboard
Clipboard.SetText(text)BooleanWrite text to the clipboard
Clipboard.HasText()BooleanCheck if text is available
Clipboard.Clear()Clear the clipboard

Notification Module

Send macOS desktop notifications (banners/alerts).

// Send a notification immediately
Var ok As Boolean = Notification.Send("Build Complete", "Your project compiled successfully.")

// Send with a delay (in seconds)
Notification.Send("Reminder", "Time to take a break!", 300)

// Remove all pending and delivered notifications
Notification.RemoveAll()

Methods

MethodReturnsDescription
Notification.Send(title, body)BooleanSend a notification immediately
Notification.Send(title, body, delay)Send after delay seconds
Notification.RemoveAll()Remove all pending and delivered notifications

Shell Module

Execute terminal commands and capture their output. Returns a result object with stdout, stderr, and exit code.

// Execute a shell command
Var result As Object = Shell.Execute("ls -la")

// Access the result
Print(result.Output)       // stdout as String
Print(result.ErrorOutput)  // stderr as String
Print(result.ExitCode)     // 0 = success

// Example: check if a command succeeded
Var r As Object = Shell.Execute("which python3")
If r.ExitCode = 0 Then
    Print("Python3 found at: " + r.Output)
Else
    Print("Python3 not installed")
End If

Result Properties

PropertyTypeDescription
OutputStringStandard output (stdout)
ErrorOutputStringStandard error (stderr)
ExitCodeIntegerExit code (0 = success)
Security: Shell commands run with the same permissions as the Neuridion IDE. Be careful with user-supplied input to avoid command injection.

Storage Module

Persistent key-value storage that saves data as .neuridion_storage.json in the project folder. Values persist across program runs.

// Store a value (any type: String, Integer, Double, Boolean, Array)
Storage.Set("username", "Max")
Storage.Set("highscore", 9500)
Storage.Set("darkMode", True)

// Read a value (returns Nil if key doesn't exist)
Var name As String = Storage.Get("username")
Var score As Integer = Storage.Get("highscore")

// Check if a key exists
If Storage.Has("username") Then
    Print("Welcome back, " + Storage.Get("username"))
End If

// Remove a single key (returns True if key existed)
Var removed As Boolean = Storage.Remove("darkMode")

// Get all entries as an Object
Var all As Object = Storage.GetAll()

// Clear all stored data
Storage.Clear()

Methods

MethodReturnsDescription
Storage.Set(key, value)Store a value under the given key
Storage.Get(key)Any / NilRead the value for a key, or Nil if not found
Storage.Has(key)BooleanCheck if a key exists
Storage.Remove(key)BooleanRemove a key (returns True if it existed)
Storage.GetAll()ObjectGet all stored key-value pairs
Storage.Clear()Remove all stored data
Note: Data is saved to .neuridion_storage.json in the project folder. It persists across program runs but is specific to each project.

QR Code Module

Generate and read QR codes. Generated codes are returned as Picture objects that can be displayed, saved, or processed with image filters.

// Generate a QR code
Var qr As Object = QRCode.Generate("Hello World!")
qr.Show()

// Generate with custom size (default 256)
Var bigQR As Object = QRCode.Generate("https://example.com", 512)
bigQR.SaveToFile("/tmp/qr.png")

// Read a QR code from a picture
Var decoded As String = QRCode.Read(qr)
Print(decoded)  // "Hello World!"
MethodReturnsDescription
QRCode.Generate(text)PictureCreate a 256×256 QR code image
QRCode.Generate(text, size)PictureCreate a QR code with custom size in pixels
QRCode.Read(picture)String / NilRead QR code content from a Picture (uses Vision)
Tip: QR codes are standard Picture objects — you can use all Picture methods like SaveToFile(), ApplyFilter(), DrawText(), or Show() on them.

CSV Module

Parse and write CSV (Comma-Separated Values) files. Supports custom delimiters and properly handles quoted fields.

// Parse CSV text into 2D array
Var text As String = "Name,Age,City\nAlice,30,Berlin"
Var data As Array = CSV.Parse(text)
Print(data[0][0])  // "Name"
Print(data[1][2])  // "Berlin"

// Read CSV from file
Var rows As Array = CSV.Read("/path/data.csv")

// Create and write CSV
Var output As Array = []
output.Append(["Product", "Price"])
output.Append(["Laptop", "999.99"])
CSV.Write("/tmp/products.csv", output)

// Use semicolon as delimiter
Var semi As Array = CSV.Parse(text, ";")
CSV.Write("/tmp/data.csv", output, ";")

// Convert to string without saving
Var csvStr As String = CSV.ToString(output)
MethodReturnsDescription
CSV.Parse(text)ArrayParse CSV text into a 2D array (rows × columns)
CSV.Parse(text, delimiter)ArrayParse with custom delimiter (e.g. ";", "\t")
CSV.Read(path)ArrayRead and parse a CSV file
CSV.Read(path, delimiter)ArrayRead a CSV file with custom delimiter
CSV.Write(path, data)BooleanWrite a 2D array as CSV file
CSV.Write(path, data, delimiter)BooleanWrite CSV with custom delimiter
CSV.ToString(data)StringConvert 2D array to CSV string
CSV.ToString(data, delimiter)StringConvert with custom delimiter

PDF Module

Create, read, and manipulate PDF documents. Supports drawing text, shapes, images, tables, interactive form fields, metadata, page numbers, password protection, and merging.

Creating a PDF

Var doc As Object = PDF.Create()
doc.SetTitle("My Report")
doc.SetAuthor("Neuridion")

// Add page (default A4: 595 x 842 points)
doc.AddPage()

// Draw content
doc.SetFont("Helvetica-Bold", 24)
doc.SetColor(0, 0, 0)
doc.DrawText(50, 50, "Hello PDF!")

doc.SetFont("Helvetica", 12)
doc.DrawLine(50, 80, 500, 80)
doc.DrawRectangle(50, 100, 200, 50)
doc.FillRectangle(300, 100, 100, 50)

// Embed a picture
Var pic As Object = Graphics.CreatePicture(100, 100)
doc.DrawImage(50, 200, pic)

// Draw table from 2D array
Var data As Array = [["Name", "Score"], ["Alice", "95"], ["Bob", "87"]]
doc.DrawTable(50, 350, data)

// Save and show
doc.AddPageNumbers()
doc.SaveToFile("/tmp/report.pdf")
doc.Show()

Form Fields

doc.AddPage()
doc.DrawText(50, 50, "Name:")
doc.AddTextField(150, 40, 250, 22, "name")

doc.DrawText(50, 90, "Role:")
doc.AddDropdown(150, 80, 250, 22, "role", ["Admin", "User", "Guest"])

doc.DrawText(50, 130, "Agree:")
doc.AddCheckbox(150, 128, "agree")

doc.AddButton(150, 170, 100, 30, "Submit")
doc.AddLink(50, 220, 150, 20, "https://example.com")

Reading Existing PDFs

Var doc As Object = PDF.Open("/path/to/file.pdf")
Print(doc.PageCount)
Print(doc.GetText())
Print(doc.GetTextFromPage(0))

// Read and write form field values
Var name As String = doc.GetFieldValue("name")
doc.SetFieldValue("name", "Alice")
doc.SaveToFile("/path/to/updated.pdf")

Printing

// Print with macOS print dialog (choose printer, copies, etc.)
Var printed As Boolean = doc.Print()

// Silent print to default printer (no dialog)
doc.Print(False)

Method Reference

MethodReturnsDescription
Document
PDF.Create()PDFDocumentCreate a new empty PDF
PDF.Open(path)PDFDocument / NilOpen an existing PDF file
doc.AddPage()Add a new A4 page (595 × 842 pt)
doc.AddPage(w, h)Add page with custom size in points
doc.SetPage(index)Set current page for annotations
doc.PageCountIntegerNumber of pages (property)
doc.RemovePage(index)BooleanRemove a page by index
Drawing
doc.DrawText(x, y, text)Draw text at position
doc.SetFont(name, size)Set font (e.g. "Helvetica-Bold", 14)
doc.SetColor(r, g, b)Set color (0–255 per channel)
doc.SetLineWidth(w)Set line width in points
doc.DrawLine(x1, y1, x2, y2)Draw a line
doc.DrawRectangle(x, y, w, h)Draw rectangle outline
doc.FillRectangle(x, y, w, h)Draw filled rectangle
doc.DrawImage(x, y, picture)Embed a Picture object
doc.DrawTable(x, y, data)Draw a 2D array as table (first row = header)
Form Fields
doc.AddTextField(x, y, w, h, name)Add text input field
doc.AddCheckbox(x, y, name)Add checkbox (14×14 pt)
doc.AddDropdown(x, y, w, h, name, options)Add dropdown (options = Array)
doc.AddButton(x, y, w, h, label)Add a button
doc.AddLink(x, y, w, h, url)Add clickable URL link
doc.GetFieldValue(name)String / NilRead form field value
doc.SetFieldValue(name, value)BooleanSet form field value
Text Extraction
doc.GetText()StringExtract text from all pages
doc.GetTextFromPage(index)StringExtract text from one page
Metadata & Extras
doc.SetTitle(text)Set PDF title
doc.SetAuthor(text)Set PDF author
doc.AddPageNumbers()Add "1 / N" page numbers at bottom
doc.SetPassword(pw)Encrypt PDF with password
doc.Merge(otherDoc)BooleanAppend pages from another PDF
doc.SaveToFile(path)BooleanSave to file
doc.Show()Show in preview window
doc.Print()BooleanPrint with macOS print dialog
doc.Print(showDialog)BooleanPrint silently if False
Note: Coordinates use top-left origin (y=0 at top). Standard page sizes: A4 = 595×842 pt, Letter = 612×792 pt. 1 pt = 1/72 inch.

Synth Module

Real-time sound synthesizer with waveform generation, ADSR envelope, reverb, and delay effects. Play notes by name (e.g. "C4", "F#5"), frequency, chords, or sequences.

Playing Notes

// Play a single note (note name + duration in seconds)
Synth.PlayNote("C4", 0.5)
Synth.PlayNote("F#5", 0.3)

// Play by frequency (Hz)
Synth.PlayFrequency(440, 0.5)

// Play a chord (array of note names)
Synth.PlayChord(["C4", "E4", "G4"], 1.0)

// Play a sequence of notes
Synth.PlaySequence(["C4", "D4", "E4", "F4", "G4"], 0.3)

// Rest (silence)
Synth.Rest(0.5)

// Quick beep sound
Synth.Beep()

Waveforms & Sound Shaping

// Set waveform: "sine", "square", "sawtooth"/"saw", "triangle"/"tri"
Synth.SetWave("sine")

// Volume (0.0 to 1.0)
Synth.SetVolume(0.6)

// ADSR envelope (all in seconds, sustain is 0.0-1.0 level)
Synth.SetAttack(0.01)
Synth.SetDecay(0.1)
Synth.SetSustain(0.5)
Synth.SetRelease(0.3)

Effects

// Reverb (0-100 wet/dry mix)
Synth.SetReverb(50)

// Delay (time in seconds, feedback 0-100)
Synth.SetDelay(0.3, 40)

// Frequency sweep
Synth.SweepUp(200, 800, 1.0)
Synth.SweepDown(800, 200, 1.0)

// White noise
Synth.Noise(0.5)

// Stop playback
Synth.Stop()

Note Names

Notes use scientific pitch notation: letter + optional sharp/flat + octave number.
Examples: C4 (Middle C), A4 (440 Hz), F#5, Bb3, G#2.

Method Reference

MethodDescription
Playback
Synth.PlayNote(note, duration)Play note by name (e.g. "C4", "F#5")
Synth.PlayFrequency(hz, duration)Play note by frequency in Hz
Synth.PlayChord(notes, duration)Play multiple notes simultaneously
Synth.PlaySequence(notes, noteDuration)Play notes one after another
Synth.Rest(duration)Silent pause
Synth.Beep()Quick 800 Hz beep
Synth.Stop()Stop current playback
Waveform & Volume
Synth.SetWave(name)"sine", "square", "sawtooth"/"saw", "triangle"/"tri"
Synth.SetVolume(level)Volume 0.0–1.0
ADSR Envelope
Synth.SetAttack(seconds)Attack time (fade in)
Synth.SetDecay(seconds)Decay time (fade to sustain)
Synth.SetSustain(level)Sustain level 0.0–1.0
Synth.SetRelease(seconds)Release time (fade out)
Effects
Synth.SetReverb(wetDry)Reverb mix 0–100
Synth.SetDelay(time, feedback)Delay: time in sec, feedback 0–100
Synth.SweepUp(startHz, endHz, dur)Frequency sweep upward
Synth.SweepDown(startHz, endHz, dur)Frequency sweep downward
Synth.Noise(duration)White noise burst
Offline Rendering
Synth.StartRender()Switch to offline render mode (no audio output)
Synth.SaveRender(path)Save rendered audio as WAV file, returns Boolean

Offline Rendering

Generate audio files without playing sound. In render mode, all Play/Sweep/Noise/Rest methods render instantly into a buffer instead of producing real-time audio.

// Render a melody to WAV file
Synth.SetWave("triangle")
Synth.SetVolume(0.8)
Synth.StartRender()

Synth.PlayNote("C4", 0.5)
Synth.PlayNote("E4", 0.5)
Synth.PlayNote("G4", 0.5)
Synth.PlayChord(["C4", "E4", "G4"], 1.0)

Var path As String = FileAndFolder.TempDirectory + "/melody.wav"
If Synth.SaveRender(path) Then
    Print($"Saved to: {path}")
End If
Tip: The synth engine starts automatically on first use. Combine different waveforms, ADSR settings, and effects to create distinct instrument sounds — from bright glockenspiel (sine, short decay, reverb) to retro chiptune (square, no effects) to dreamy ambient pads (triangle, long attack, heavy reverb). Use StartRender() + SaveRender() to export your compositions as WAV files.
🎵 Try it! — Play a melody
Make your computer play "Twinkle Twinkle Little Star":
Synth.SetWave("sine")
Synth.SetReverb(30)

// Twinkle Twinkle Little Star
Var notes As Array = ["C4", "C4", "G4", "G4", "A4", "A4", "G4"]
Synth.PlaySequence(notes, 0.4)
Synth.Rest(0.2)

Var notes2 As Array = ["F4", "F4", "E4", "E4", "D4", "D4", "C4"]
Synth.PlaySequence(notes2, 0.4)

Chart Module

Create bar, line, pie, and scatter charts. Charts can be displayed in a window, saved as PNG, or converted to Picture objects for PDF embedding.

Creating Charts

// Bar chart
Var bar As Object = Chart.Bar(["Q1", "Q2", "Q3"], [85, 120, 200])
bar.Title = "Revenue"
bar.Show()

// Line chart
Var line As Object = Chart.Line(["Jan", "Feb", "Mar"], [10, 25, 18])
line.Title = "Growth"
line.Show()

// Pie chart
Var pie As Object = Chart.Pie(["Desktop", "Mobile"], [60, 40])
pie.Title = "Platforms"
pie.Show()

// Scatter chart
Var sc As Object = Chart.Scatter(["1", "2", "3"], [15, 42, 28])
sc.Show()

Customization & Export

bar.SetSize(800, 500)
bar.SetColor(0, 100, 200)
bar.SaveToFile("/tmp/chart.png")

// Get as Picture object (for PDF embedding)
Var pic As Object = bar.ToPicture()

Method Reference

MethodReturnsDescription
Create Charts
Chart.Bar(labels, values)ChartCreate a bar chart
Chart.Line(labels, values)ChartCreate a line chart
Chart.Pie(labels, values)ChartCreate a pie chart
Chart.Scatter(xLabels, yValues)ChartCreate a scatter chart
Chart Properties & Methods
chart.TitleStringChart title (property)
chart.SetSize(w, h)Set chart dimensions in pixels
chart.SetColor(r, g, b)Set primary color (0–255)
chart.Show()Display chart in a window
chart.SaveToFile(path)BooleanSave as PNG image
chart.ToPicture()PictureConvert to Picture object
Tip: Default chart size is 600×400 pixels. Pie charts use an automatic color palette. Bar and line charts show values at each data point. Use ToPicture() to embed charts in PDF documents.
📊 Try it! — Chart your favorite things
Create a pie chart of your favorite activities:
Var activities As Array = ["Gaming", "Reading", "Coding", "Sports"]
Var hours As Array = [5, 3, 8, 4]

Var chart As Object = Chart.Pie(activities, hours)
chart.Title = "My Week"
chart.SetSize(500, 400)
chart.Show()

Translate Module

Detect languages and translate text on-device using Apple’s machine learning frameworks. No internet connection required.

Language Detection

Var lang As String = Translate.DetectLanguage("Bonjour le monde")
Print(lang)  // "fr"

// Multiple candidates with confidence
Var candidates As Array = Translate.DetectLanguages("Ciao bella!", 3)

Translation

// Auto-detect source language
Var german As String = Translate.Text("Hello World", "de")

// Explicit source language
Var english As String = Translate.Text("Hallo Welt", "en", "de")

Method Reference

MethodReturnsDescription
Translate.Text(text, target)String / NilTranslate text to target language (auto-detect source)
Translate.Text(text, target, source)String / NilTranslate with explicit source language
Translate.DetectLanguage(text)String / NilDetect the dominant language
Translate.DetectLanguages(text, count)ArrayTop N language candidates with confidence
Language codes: Use ISO 639 codes: "en" (English), "de" (German), "fr" (French), "es" (Spanish), "it" (Italian), "ja" (Japanese), "zh" (Chinese), "ko" (Korean), "pt" (Portuguese), "ru" (Russian), etc.

Encoding Module

Encode and decode data in various formats: Base64, Hex, URL, HTML. Convert between text encodings and number systems.

Data Encoding

// Base64
Var encoded As String = Encoding.Base64Encode("Hello")
Var decoded As String = Encoding.Base64Decode(encoded)

// Hex
Var hex As String = Encoding.HexEncode("ABC")
Var back As String = Encoding.HexDecode(hex)

// URL encoding
Var url As String = Encoding.URLEncode("name=Max&city=München")

// HTML escaping
Var safe As String = Encoding.HTMLEscape("<b>bold</b>")

Text Encoding

// Get byte values of a string
Var bytes As Array = Encoding.ToBytes("Ä", "utf8")
Var text As String = Encoding.FromBytes(bytes, "utf8")
Var len As Integer = Encoding.ByteLength("Hello", "utf8")

Number Systems

Var bin As String = Encoding.ToBinary(255)     // "11111111"
Var oct As String = Encoding.ToOctal(255)      // "377"
Var hex As String = Encoding.ToHex(255)        // "ff"
Var n As Integer = Encoding.FromBinary("1010")  // 10
Var b3 As String = Encoding.ToBase(42, 3)     // arbitrary base 2-36

Character / ASCII

Var ch As String = Encoding.Char(65)          // "A"
Var cr As String = Encoding.Char(13)          // carriage return
Var heart As String = Encoding.Char(9829)    // "♥" (Unicode)

Var code As Integer = Encoding.ASCII("A")     // 65
Var euro As Integer = Encoding.ASCII("€")     // 8364

Common character codes:

CodeNameDescription
9TabHorizontal tab (\t)
10Linefeed (LF)New line (\n)
13Carriage Return (CR)Return to line start
32SpaceBlank space
34Double Quote"
39Single Quote'
48–57Digits09
65–90UppercaseAZ
97–122Lowercaseaz
92Backslash\
127Delete (DEL)Delete character

Method Reference

MethodReturnsDescription
Encoding.Base64Encode(text)StringEncode text as Base64
Encoding.Base64Decode(base64)String / NilDecode Base64 string
Encoding.HexEncode(text)StringEncode text as hex bytes
Encoding.HexDecode(hex)String / NilDecode hex string to text
Encoding.URLEncode(text)StringPercent-encode for URLs
Encoding.URLDecode(text)StringDecode percent-encoded string
Encoding.HTMLEscape(text)StringEscape HTML special characters
Encoding.HTMLUnescape(text)StringUnescape HTML entities
Encoding.ToBytes(text, encoding)ArrayGet byte values of text in given encoding
Encoding.FromBytes(array, encoding)String / NilCreate string from byte array
Encoding.ByteLength(text, encoding)IntegerByte length in given encoding
Encoding.ListEncodings()ArrayList supported encoding names
Encoding.ToBinary(n)StringInteger to binary string
Encoding.FromBinary(s)Integer / NilBinary string to integer
Encoding.ToOctal(n)StringInteger to octal string
Encoding.FromOctal(s)Integer / NilOctal string to integer
Encoding.ToHex(n)StringInteger to hex string
Encoding.FromHex(s)Integer / NilHex string to integer
Encoding.ToBase(n, base)StringInteger to arbitrary base (2–36)
Encoding.FromBase(s, base)Integer / NilString in base to integer
Encoding.Char(code)String / NilUnicode codepoint to character
Encoding.ASCII(character)Integer / NilFirst character to Unicode codepoint
Supported encodings: utf8, utf16, utf16be, utf16le, utf32, ascii, latin1, latin2, windows1252, macRoman, shiftJIS, iso2022jp

Email Module

Send and receive emails via SMTP and IMAP. Supports text, HTML, attachments, CC/BCC, and project-level email configuration.

TLS is automatic: Port 465/993 uses direct TLS. Port 587/143 uses STARTTLS. No manual encryption settings needed.

Quick Send (Project Settings)

Configure your SMTP server in Project Settings > Email (SMTP), then send with a single call:

// Simple text email
Email.Send("recipient@example.com", "Subject", "Hello from Neuridion!")

// With HTML body
Email.Send("recipient@example.com", "Newsletter", "Plain text", "<h1>HTML</h1>")

// With attachment
Email.Send("recipient@example.com", "Invoice", "See attached.", "", "/path/to/file.pdf")
ParameterTypeDescription
toStringRecipient email (comma-separated for multiple)
subjectStringEmail subject line
bodyStringPlain text body
htmlString(Optional) HTML body
attachmentString(Optional) File path to attach

Mail Object (CC, BCC, Multiple Attachments)

For more control, create a Mail object:

Var mail As Object = Email.Create()
mail.To = "recipient@example.com"
mail.CC = "copy@example.com, manager@example.com"
mail.BCC = "archive@example.com"
mail.Subject = "Monthly Report"
mail.Body = "Please find the report attached."
mail.HTML = "<h1>Report</h1><p>See attachments.</p>"
mail.AddAttachment("/path/to/report.pdf")
mail.AddAttachment("/path/to/data.csv")
mail.Send()
PropertyTypeDescription
mail.FromStringSender address (defaults to project settings)
mail.ToStringRecipients (comma-separated)
mail.CCStringCarbon Copy recipients
mail.BCCStringBlind Carbon Copy recipients
mail.SubjectStringSubject line
mail.BodyStringPlain text body
mail.HTMLStringHTML body
MethodReturnsDescription
mail.AddAttachment(path)NilAdd a file attachment
mail.Send()BooleanSend using project SMTP settings

Manual SMTP Connection

Var smtp As Object = Email.SMTP("smtp.gmail.com", 587, "you@gmail.com", "app-password")

Var mail As Object = Email.Create()
mail.To = "friend@example.com"
mail.CC = "boss@example.com"
mail.Subject = "Hello"
mail.Body = "Greetings from Neuridion!"
mail.AddAttachment("/path/to/photo.jpg")

smtp.Send(mail)
smtp.Close()
MethodReturnsDescription
Email.SMTP(host, port, user, pass)ObjectCreate SMTP connection
smtp.Send(mail)BooleanSend a Mail object
smtp.Close()NilClose connection

Fetch Emails (IMAP)

Fetching emails always requires an explicit IMAP connection with your credentials:

Var imap As Object = Email.IMAP("imap.gmail.com", 993, "you@gmail.com", "app-password")

// Fetch recent emails
Var mails As Array = imap.Fetch(10)
For Each msg In mails
    Print($"[{msg.UID}] {msg.Subject}")

    // Save attachments
    If msg.Attachments > 0 Then
        Var saved As Integer = msg.SaveAttachments("/Downloads/")
        Print($"  Saved {saved} attachments")
    End If
End For

// Search by subject keyword
Var results As Array = imap.Search("invoice")

// List all folders
Var folders As Array = imap.Folders()

// Mark as read / delete
imap.MarkRead(123)
imap.Delete(456)

imap.Close()

Received Mail Properties

PropertyTypeDescription
msg.UIDIntegerUnique message ID
msg.FromStringSender address
msg.ToStringRecipient address
msg.CCStringCC recipients
msg.SubjectStringSubject line
msg.DateStringDate sent
msg.BodyStringPlain text body
msg.HTMLStringHTML body (if present)
msg.AttachmentsIntegerNumber of attachments
msg.IsReadBooleanRead status
MethodReturnsDescription
msg.SaveAttachments(folderPath)IntegerSave all attachments, returns count saved

IMAP Connection Methods

MethodReturnsDescription
Email.IMAP(host, port, user, pass)ObjectCreate IMAP connection
imap.Fetch(count?)ArrayFetch last count emails (default 10)
imap.FetchUnread()ArrayFetch all unread emails
imap.Search(keyword)ArraySearch emails by subject keyword
imap.Folders()ArrayList all mailbox folders
imap.MarkRead(uid)BooleanMark message as read
imap.Delete(uid)BooleanDelete message
imap.Close()NilClose connection

Project Email Settings

For quick send/fetch without specifying credentials, configure email in Project Settings:

SMTP Settings: From Address, Host, Port, Username, Password
IMAP Settings: Host, Port, Username, Password

Passwords are stored encrypted in Neuridion.project. Use App Passwords for Gmail, Outlook, etc.

Screen Module

Query display properties, capture screenshots, and read pixel colors.

// Display information
Var w As Integer = Screen.Width()
Var h As Integer = Screen.Height()
Var scale As Double = Screen.ScaleFactor()
Var dark As Boolean = Screen.DarkMode()

// Mouse position (top-left origin)
Var mx As Integer = Screen.MouseX()
Var my As Integer = Screen.MouseY()

// Take a screenshot (returns a Picture object)
Var pic As Object = Screen.Screenshot()
pic.Show()

// Screenshot a region
Var region As Object = Screen.ScreenshotRegion(0, 0, 400, 300)

// Save screenshot to file
Screen.ScreenshotToFile("/tmp/screenshot.png")

// Read pixel color at screen coordinates
Var color As Object = Screen.PixelColor(100, 100)
Print(color["R"])  // 0-255

Method Reference

MethodReturnsDescription
Screen.Width()IntegerMain display width in points
Screen.Height()IntegerMain display height in points
Screen.ScaleFactor()DoubleDisplay scale (2.0 for Retina)
Screen.DarkMode()BooleanTrue if macOS dark mode is active
Screen.Displays()ArrayAll displays with Name/Width/Height/Scale/Index
Screen.MouseX()IntegerMouse X position (from left)
Screen.MouseY()IntegerMouse Y position (from top)
Screen.Screenshot()PictureCapture full screen as Picture
Screen.ScreenshotRegion(x, y, w, h)PictureCapture screen region as Picture
Screen.ScreenshotToFile(path)BooleanSave screenshot as PNG file
Screen.PixelColor(x, y)ObjectRGB color at screen position {R, G, B}

Location Module

Geocode addresses, reverse-geocode coordinates, calculate distances and bearings between locations.

// Search an address (geocoding)
Var loc As Object = Location.SearchAddress("Eiffel Tower, Paris")
Print(loc.Latitude)
Print(loc.Longitude)
Print(loc.ToString())

// Reverse geocoding
Var info As Object = Location.SearchCoordinates(48.8584, 2.2945)
Print(info["City"])     // "Paris"
Print(info["Country"])  // "France"

// Distance between two points (in meters)
Var dist As Double = Location.DistanceBetween(48.8566, 2.3522, 52.5200, 13.4050)

// Compass bearing between two points
Var bearing As Double = Location.BearingBetween(48.8566, 2.3522, 52.5200, 13.4050)

// Current GPS location (requires permission)
Var here As Object = Location.Current()

Location Object Properties

PropertyTypeDescription
LatitudeDoubleLatitude in degrees
LongitudeDoubleLongitude in degrees
AltitudeDoubleAltitude in meters
AccuracyDoubleHorizontal accuracy in meters

Method Reference

MethodReturnsDescription
Location.Current()Location / NilGet current GPS location
Location.SearchAddress(address)Location / NilGeocode an address to coordinates
Location.SearchCoordinates(lat, lon)Object / NilReverse geocode to address info
Location.DistanceBetween(lat1, lon1, lat2, lon2)DoubleDistance in meters
Location.BearingBetween(lat1, lon1, lat2, lon2)DoubleCompass bearing in degrees (0–360)
loc.DistanceTo(otherLoc)DoubleDistance between two Location objects
loc.ToString()StringFormatted coordinate string
Reverse geocode result keys: Name, Street, HouseNumber, City, State, Country, PostalCode

AI Module

The AI module lets you talk to AI right from your code! Neuridion supports multiple AI providers through a simple, unified API. The best part: Apple AI runs right on your Mac — no account, no API key, completely free.

Apple AI (on-device)

Uses Apple Foundation Models. Runs locally, no API key needed. Requires Apple Silicon Mac with macOS 26+. This is the easiest way to get started with AI!

Var apple As Object = AI.Apple()

If apple.IsAvailable() Then
    Var answer As String = apple.Generate("What is an array?")
    Print(answer)

    Var poem As String = apple.GenerateWith("Write a poem", "You are a poet")
    Var summary As String = apple.Summarize("Long text here...")
    Var german As String = apple.Translate("Hello!", "German")
End If
💡 Try it! — Build an AI-powered quiz
Let Apple AI generate quiz questions and check your answers:
Var apple As Object = AI.Apple()
Var question As String = apple.GenerateWith("Ask me a fun trivia question with 3 multiple choice answers (A, B, C). Include the correct answer at the end.", "You are a friendly quiz host.")
Print(question)

Var answer As String = Console.ReadLine("Your answer (A, B or C):")
Print("You picked: " + answer)
🌍 Try it! — Translate anything instantly
Apple AI can translate text to any language — all on your Mac:
Var apple As Object = AI.Apple()
Var english As String = "I love programming!"

Var french As String = apple.Translate(english, "French")
Var japanese As String = apple.Translate(english, "Japanese")
Var spanish As String = apple.Translate(english, "Spanish")

Print("French: " + french)
Print("Japanese: " + japanese)
Print("Spanish: " + spanish)

Claude AI (Anthropic API)

Uses the Anthropic Messages API. Requires an API key from console.anthropic.com.

Var claude As Object = AI.Claude("sk-ant-your-key")
// Optional: specify model
Var claude2 As Object = AI.Claude("sk-ant-your-key", "claude-opus-4-20250514")

Var answer As String = claude.Generate("Explain recursion")
Var code As String = claude.GenerateWith("Write a sort function", "You are a Neuridion expert")
Var summary As String = claude.Summarize("Long article text...")
Var french As String = claude.Translate("Good morning", "French")

OpenAI (GPT)

Uses the OpenAI Chat Completions API. Requires an API key from platform.openai.com.

Var gpt As Object = AI.OpenAI("sk-your-key")
// Optional: specify model
Var gpt2 As Object = AI.OpenAI("sk-your-key", "gpt-4o-mini")

Var answer As String = gpt.Generate("Explain recursion")
Var code As String = gpt.GenerateWith("Write a sort function", "You are a programmer")
Var summary As String = gpt.Summarize("Long article text...")
Var italian As String = gpt.Translate("Good morning", "Italian")

Google Gemini AI

Uses the Google Gemini API. Requires an API key from aistudio.google.com.

Var gemini As Object = AI.Google("AIza-your-key")
// Optional: specify model
Var gemini2 As Object = AI.Google("AIza-your-key", "gemini-2.0-pro")

Var answer As String = gemini.Generate("What is machine learning?")
Var text As String = gemini.GenerateWith("Explain AI", "You are a teacher")
Var summary As String = gemini.Summarize("Long text...")
Var spanish As String = gemini.Translate("Thank you", "Spanish")

Session Creation

MethodReturnsDescription
AI.Apple()ObjectCreate Apple AI session (on-device, no key needed)
AI.Claude(apiKey [, model])ObjectCreate Claude session (default: claude-sonnet-4-5-latest)
AI.OpenAI(apiKey [, model])ObjectCreate OpenAI session (default: gpt-4o)
AI.Google(apiKey [, model])ObjectCreate Google Gemini session (default: gemini-2.0-flash)
AI.Local(model [, url])ObjectCreate local AI session (default: http://localhost:11434)

Session Methods (all providers)

MethodReturnsDescription
session.Generate(prompt)StringGenerate text from a prompt
session.GenerateWith(prompt, instructions)StringGenerate with system instructions
session.Summarize(text)StringSummarize a text
session.Translate(text, language)StringTranslate text to target language

Apple AI only:

MethodReturnsDescription
apple.IsAvailable()BooleanCheck if the on-device model is available

Local AI (Ollama, LM Studio, etc.)

Works with any local server that provides an OpenAI-compatible API. No API key needed — everything runs on your machine.

// Ollama (default port 11434)
Var ollama As Object = AI.Local("llama3.2")
Var answer As String = ollama.Generate("What is recursion?")
Print(answer)

// LM Studio (port 1234)
Var lm As Object = AI.Local("my-model", "http://localhost:1234")
Var summary As String = lm.Summarize("Long text here...")

// llama.cpp or other server on a different machine
Var remote As Object = AI.Local("mistral", "http://192.168.1.5:8080")
Var translated As String = remote.Translate("Hello", "German")
MethodReturnsDescription
AI.Local(model [, url])ObjectCreate local AI session (default: http://localhost:11434)

The default URL http://localhost:11434 is the Ollama default port. For other servers, pass the URL as second parameter:

ServerDefault URLInstall
Ollamahttp://localhost:11434ollama.comollama pull llama3.2
LM Studiohttp://localhost:1234lmstudio.ai → load model → start server
llama.cpphttp://localhost:8080llama-cpp-python or compiled binary
Requirement: The local server must be running before calling AI.Local(). If the server is not reachable, the method returns [Error: ...]. The model name must match an installed model (e.g. ollama list shows available models).
About model names: The default models for cloud providers use alias names (e.g. claude-sonnet-4-5-latest, gpt-4o) that automatically point to the newest version. If you specify a model explicitly, prefer alias names over dated versions (e.g. claude-sonnet-4-5-20250929) — dated versions may be deprecated by the provider over time. Local models don't have this problem — you control which models are installed.

Vision Methods (on Picture objects)

These methods are available on pictures created with Graphics.CreatePicture() or Graphics.LoadPicture(). They use Apple Vision framework (no API key needed).

Var pic As Object = Graphics.LoadPicture("/path/to/image.png")
Var text As String = pic.RecognizeText()         // OCR
Var faces As Array = pic.DetectFaces()           // face detection
Var barcodes As Array = pic.DetectBarcodes()   // QR/barcodes
Var labels As Array = pic.ClassifyImage()       // image classification
MethodReturnsDescription
pic.RecognizeText()StringOCR — all recognized text (en/de)
pic.RecognizeTextLines()ArrayOCR — each line as separate string
pic.DetectFaces()ArrayArray of {X, Y, Width, Height, Confidence}
pic.DetectBarcodes()ArrayArray of {Value, Type}
pic.DetectAnimals()ArrayArray of {Label, Confidence}
pic.ClassifyImage()ArrayArray of {Label, Confidence} (top 10)
pic.DetectRectangles()ArrayArray of {X, Y, Width, Height, Confidence}
Note: Apple AI and Local AI run entirely on your machine — no data leaves your Mac. Claude, OpenAI and Google require an internet connection and API key. Errors are returned as strings starting with [Error: ...].

Calendar Module

Read, create, and manage calendar events and reminders using macOS EventKit. Requires user permission on first use.

Reading Events

// Today's events
Var today As Array = Calendar.Today()
For Each event In today
    Print($"{event.Title}: {event.Start} - {event.End}")
End For

// Events in a date range
Var events As Array = Calendar.Events("2025-03-01", "2025-03-31")

// Next upcoming event
Var next As Object = Calendar.NextEvent()
If next <> Nil Then
    Print($"{next.Title} at {next.Start}")
End If

// Check if a time is busy
If Calendar.Busy("2025-03-20 14:00") Then
    Print("That time is busy")
End If

Creating & Saving Events

Var ev As Object = Calendar.CreateEvent("Team Meeting")
ev.Start = "2025-04-01 10:00"
ev.End = "2025-04-01 11:00"
ev.Location = "Conference Room"
ev.Notes = "Quarterly review"
ev.Save()

// Delete an event
ev.Delete()

Reminders

// All reminders
Var all As Array = Calendar.Reminders()

// Open (incomplete) reminders only
Var open As Array = Calendar.OpenReminders()

// Create a reminder
Var rem As Object = Calendar.CreateReminder("Buy groceries")
rem.DueDate = "2025-03-20"
rem.Priority = 1
rem.Notes = "Milk, eggs, bread"
rem.Save()

// Mark as completed
rem.Complete()

Listing Calendars

Var cals As Array = Calendar.List()
For Each c In cals
    Print($"{c.Title} ({c.Type})")
End For

Reference

MethodReturnsDescription
Calendar.Today()ArrayToday's events
Calendar.Events(from, to)ArrayEvents in date range (YYYY-MM-DD)
Calendar.NextEvent()Object/NullNext upcoming event
Calendar.Busy(dateTime)BooleanCheck if time is occupied
Calendar.CreateEvent(title)ObjectCreate a new event
Calendar.DeleteEvent(event)BooleanDelete an event
Calendar.List()ArrayList all calendars
Calendar.Reminders()ArrayAll reminders
Calendar.OpenReminders()ArrayIncomplete reminders
Calendar.CreateReminder(title)ObjectCreate a new reminder

Event properties: Title, Start, End, Location, Notes, IsAllDay, CalendarName, URL

Event methods: Save(), Delete()

Reminder properties: Title, Notes, DueDate, Priority (0=none, 1=high, 5=low), IsCompleted, CompletionDate, List

Reminder methods: Save(), Complete(), Delete()

Dates: Use format YYYY-MM-DD or YYYY-MM-DD HH:mm. The system will prompt for calendar/reminders permission on first use.

Contacts Module

Search, create, and manage contacts from the macOS address book using the Contacts framework. Requires user permission on first use.

Searching Contacts

// Search by name
Var results As Array = Contacts.Search("Apple")
For Each c In results
    Print($"{c.FirstName} {c.LastName}")
    Print($"  Email: {c.Email}")
End For

// Search by email or phone
Var byEmail As Array = Contacts.SearchByEmail("john@example.com")
Var byPhone As Array = Contacts.SearchByPhone("+1234567890")

// All contacts and count
Var all As Array = Contacts.All()
Var count As Integer = Contacts.Count()
Print($"You have {count} contacts")

Creating & Saving Contacts

Var c As Object = Contacts.Create("John", "Doe")
c.Email = "john@example.com"
c.Phone = "+1 555 1234"
c.Company = "Acme Inc."
c.Street = "123 Main St"
c.City = "San Francisco"
c.PostalCode = "94102"
c.Save()

// Delete the contact
c.Delete()

VCard Export

Var vcard As String = Contacts.VCard(c)
Print(vcard)

Groups

Var groups As Array = Contacts.Groups()
For Each g In groups
    Print(g.Name)
End For

Reference

MethodReturnsDescription
Contacts.Search(name)ArraySearch contacts by name
Contacts.SearchByEmail(email)ArraySearch by email address
Contacts.SearchByPhone(phone)ArraySearch by phone number
Contacts.All()ArrayAll contacts
Contacts.Count()IntegerNumber of contacts
Contacts.Create(first, last)ObjectCreate a new contact
Contacts.Groups()ArrayAll contact groups
Contacts.VCard(contact)StringExport as vCard string

Contact properties: FirstName, LastName, Email, Phone, Company, JobTitle, Street, City, PostalCode, State, Country, Birthday, Note, ImageAvailable

Contact methods: Save(), Delete(), FullName()

Note: The system will prompt for contacts permission on first use. Email and Phone return the first available value. Use VCard() for a standard export format.

Hardware Module

Query CPU, memory, battery, disk, and display information about the current Mac.

// CPU Info
Var cpu As Object = Hardware.CPU()
Print($"Model: {cpu.Model}")
Print($"Cores: {cpu.Cores} (Physical: {cpu.PhysicalCores})")

// Memory Info
Var mem As Object = Hardware.Memory()
Print($"RAM: {mem.Total} MB total, {mem.Available} MB available")

// Battery (Null on desktop Macs)
Var bat As Object = Hardware.Battery()
If bat <> Null Then
    Print($"Battery: {bat.Level}% — Charging: {bat.IsCharging}")
End If

// Disk Space
Var disk As Object = Hardware.Disk()
Print($"Disk: {disk.Free} GB free of {disk.Total} GB")

// Disk for a specific path
Var ext As Object = Hardware.DiskFor("/Volumes/External")

// System info
Print($"Model: {Hardware.MacModel()}")
Print($"Uptime: {Hardware.Uptime()} seconds")
Print($"Thermal: {Hardware.ThermalState()}")

// Connected displays
Var displays As Array = Hardware.Displays()
For Each d In displays
    Print($"{d.Name}: {d.Width}x{d.Height} @{d.ScaleFactor}x")
End For

Method Reference

MethodReturnsDescription
Hardware.CPU()ObjectCPU info: Model, Cores, PhysicalCores
Hardware.Memory()ObjectRAM info: Total, Available, Used (MB), Pressure (0.0–1.0)
Hardware.Battery()Object/NullBattery info: Level, IsCharging, PowerSource, CycleCount. Null on desktops
Hardware.Disk()ObjectBoot disk info: Total, Free, Used (GB)
Hardware.DiskFor(path)ObjectDisk info for a specific volume path
Hardware.Uptime()DoubleSystem uptime in seconds
Hardware.ThermalState()String"Nominal", "Fair", "Serious", or "Critical"
Hardware.MacModel()StringHardware model identifier, e.g. "Mac14,2"
Hardware.Displays()ArrayConnected displays: Name, Width, Height, ScaleFactor

Bluetooth Module

Scan for and connect to Bluetooth Low Energy (BLE) devices. Requires Bluetooth permission (prompted automatically).

// Check if Bluetooth is available
If Bluetooth.IsAvailable() = False Then
    Print("Bluetooth is off")
End If

// Scan for BLE devices (3 seconds)
Var devices As Array = Bluetooth.Scan(3)
For Each dev In devices
    Print($"{dev.Name} — {dev.RSSI} dBm")
End For

// Connect to a device
Var conn As Object = Bluetooth.Connect(devices[0])
If conn <> Null Then
    // Discover services and characteristics
    conn.Discover()

    Var services As Array = conn.Services
    For Each svc In services
        Print($"Service: {svc.Name} ({svc.UUID})")
        For Each ch In svc.Characteristics
            Print($"  {ch.Name}: R={ch.IsReadable} W={ch.IsWritable}")
        End For
    End For

    // Read a characteristic (returns hex string)
    Var val As String = conn.Read("180A", "2A29")

    // Write data (hex string)
    conn.Write("FFE0", "FFE1", "01FF")

    // Disconnect
    conn.Disconnect()
End If

Method Reference

MethodReturnsDescription
Bluetooth.IsAvailable()BooleanTrue if Bluetooth is powered on
Bluetooth.Scan(seconds)ArrayScan for BLE devices. Returns device objects with Name, Identifier, RSSI
Bluetooth.Connect(device)Object/NullConnect to a scanned device. Returns connection object or Null
Bluetooth.Disconnect(conn)BooleanDisconnect a connection

Connection Object

Method/PropertyReturnsDescription
.NameStringDevice name
.IdentifierStringDevice UUID
.ServicesArrayDiscovered services (after Discover)
.Discover()BooleanDiscover services and characteristics
.Read(serviceUUID, charUUID)StringRead characteristic value as hex
.Write(serviceUUID, charUUID, hex)BooleanWrite hex data to characteristic
.Disconnect()BooleanClose the connection
Note: Bluetooth uses BLE (Bluetooth Low Energy). Classic Bluetooth devices are not supported. The system will prompt for Bluetooth permission on first use.

Keywords Reference

CategoryKeywords
VariablesVar, Dim, As
TypesString, Integer, Double, Boolean, Array, Object
ValuesTrue, False, Nil
ConditionalsIf, Then, Else, ElseIf, End If
SelectSelect Case, Case, Case Else, End Select
LoopsFor, To, Step, End For, For Each, In
LoopsWhile, End While, Do, Loop, Until
Loop ControlBreak, Continue, Exit, Stop
FunctionsFunction, End Function, Sub, End Sub, Return
ClassesClass, End Class, Inherits, New
ClassesMe, Self, Super, Constructor
ErrorsTry, Catch, Finally, End Try, Throw
LogicAnd, Or, Not, Xor
ArithmeticMod
OutputPrint
Standard LibraryMath, Console, FileAndFolder, DateAndTime, JSON, Database, Network, RegEx, System, Color, Form, XML, Audio, Compression, Graphics, Speech, Clipboard, Notification, Shell, Storage, QRCode, CSV, PDF, Synth, Chart, Translate

Keyboard Shortcuts

ShortcutAction
Cmd + RRun program
Cmd + .Stop program
Cmd + NNew file
Cmd + OOpen file
Cmd + SSave file
Cmd + Shift + SSave As
Cmd + ZUndo
Cmd + Shift + ZRedo
Cmd + XCut
Cmd + CCopy
Cmd + VPaste
Cmd + ASelect All
Cmd + FFind
Cmd + GFind Next
Cmd + Shift + GFind Previous
Cmd + LGo to Line
Cmd + +Increase font size
Cmd + -Decrease font size
Cmd + 0Reset font size
Cmd + /Toggle comment
Cmd + Shift + DToggle dark mode