Gui4Cli is an interpreted, event-driven scripting language designed to easily create graphical user interfaces (GUIs). Originally created for the Amiga by Dimitris Keletsekis, it was later ported to Windows and AmigaOS 4. It uses a simple syntax reminiscent of BASIC to let users build interfaces for stand-alone programs or act as a front-end “wrapper” to control command-line interface (CLI) applications. Core Structure of a Gui4Cli Program
A beginner’s guide to creating a Gui4Cli application revolves around understanding its unique script structure, coordinate-based widget system, and event handlers.
The Magic Header: Every Gui4Cli program file must begin with the exact letters G4C on the very first line. Without this, the interpreter will fail to recognize and load the file.
Global & Window Setup: The lines immediately following the header define global variables, window sizes, and core layout properties.
Coordinate-Based Placement: Widgets (called gadgets) like buttons, text fields, and dropdowns are placed explicitly using pixel or relative coordinates.
Event-Driven Actions: You write simple event commands directly underneath a widget to tell it what to do when interacted with (e.g., when a user clicks a button). Step-by-Step “Hello World” Example
To get started, you can write a basic layout script in a plain text editor and save it with a .g4c extension:
G4C window 100 100 300 200 “My First GUI” button 20 50 100 30 “Click Me” XUI_MsgBox “Hello World!” “You clicked the button!” Use code with caution. How it breaks down: G4C tells the engine to parse the file.
window specifies the screen coordinates and sets the title bar text.
button defines the X/Y coordinates, size, and label of a clickable button.
The indented command underneath the button triggers an event—in this case, popping up a standard message box. Key Concepts for Beginners
As you move past basic windows, the framework introduces several unique workflow mechanics:
Driving Console Apps: The “Cli” in the name means you can build a clean visual window with text inputs, catch what the user typed, and automatically pass those values behind the scenes into complex command-line or shell scripts.
Subroutine Calls: Gui4Cli allows highly efficient code reuse. You can target and run subroutines across any loaded GUI using simple Gosub commands (e.g., Gosub #this MySubroutine).
The Visual Editor: Instead of guessing coordinate placement math, the language includes a built-in visual editor that allows you to drag, drop, and resize widgets interactively.
Extensibility: Advanced users can expand the base command set by loading external plugin DLLs to interact with deeper system features. Creating a Gui4Cli Program Guide | PDF – Scribd
Leave a Reply