Macro Handler · Developer SDK
Build your own block.
Describe Lua behavior and editable fields in one .mhblock file. The same package is used in visual and logic workspaces.
Read the English guide on GitHub first, then use its versioned download link. The SDK, schema and brief are downloaded from GitHub.
Create in the app
- In a visual or logic workspace, open Add block → Plugins → Create block.
- Enter the package ID, version and name. Write the Lua code; use Add property to define editable keys, types and defaults. Read them as inputs.key in code.
- Use Preview properties to try the fields on a detached draft. Preview does not run code or change the open macro.
- After review, explicitly choose Add to block library. Use Export .mhblock to share the package; installing or exporting does not start a macro.
Saved content for an ID and version is immutable. Bump the version after edits; a library update does not change copies already embedded in macros.
Start from built-in blocks
The updated 1.0.51 author offers 14 editable Lua starters: wait, log, clipboard read/write, random number, key-value read/write, toast, file read/write/delete, JSON, date/time and string trim. Edit the defaults and choose Use this starter, then develop the code, properties, icon and design.
Copy current workspace uses the real block generator to turn the active No-Code or Logic document into an editable Lua draft. The outer macro loop and startup dialog are removed; inner loops remain. It neither changes nor runs the original macro. File, image and device references are not embedded in the package and need review on the target device.
The Create block panel fills the workspace between side rails in landscape and between top/bottom bars in portrait. Preview the property design before completing package identity and code; installation and export require full validation.
Building an advanced block
Compose real Lua APIs with local functions, conditions, bounded loops and workflows. Make the block configurable with text, number, boolean, choice, color, variable-name, point and region fields.
Groups, help, units, basic/advanced settings and numeric bounds are rendered in the native block editor. Choose a category and one of six bundled semantic icons. At runtime, the real Form API can show tabbed dialogs; Module and Workflow provide reusable steps.
The SDK’s configurable-workflow.mhblock example combines all eight field types, four groups, an optional confirmation form, a local module and bounded retries. It does not touch the screen; point and region values are read only for diagnostics.
The design uses native application controls. Schema 4 supports custom PNG icons, tabs and settings buttons. Arbitrary HTML/CSS, downloaded native components and new Android permissions are not supported. A complex scenario’s correctness depends on real APIs, execution budgets and testing on the target device.
Your block’s visual identity and controls
Choose the name, description, category, field labels and help text. Choose icon image converts a local PNG/JPEG into an embedded offline icon. The icon is preserved in the palette, No-Code card and Logic workspace.
Open Design layout and buttons to edit the form JSON: stack, sections or tabs; ordered groups; up to eight settings buttons with icons. Preset buttons apply multiple valid field values in one save; reset restores every default. Buttons do not execute Lua or start the macro.
The SDK’s designed-counter.mhblock example includes a custom icon, Work/Output tabs, Quick/Detailed profiles and reset. Try the design on a detached draft with Preview properties. Implement complex behavior with real Lua APIs; the card uses the app’s native theme and accessibility controls.
The embedded icon is a PNG up to 32 KiB and 256×256 pixels. The app downsizes and normalizes local source images up to 8 MiB. Images require no network request or server storage.
Define → validate → import
- Start from an included example; edit its package ID, version and inputs.
- Run the offline commands below with Node.js. The packer does not overwrite existing files.
- In the app, use Add block → Import → Plugins. Inspect the code and test in a separate trial macro first.
node mhblock.mjs validate examples/configurable-workflow.mhblock
node mhblock.mjs pack examples/repeated-log.mhblock --out my-block.mhblock
node --test test/package.test.mjsLocal AI Visual Decision · prepared 1.0.52
The local vision plugin runs SmolVLM-256M on the device CPU. It supports region and prompt bindings with true, false, unknown and error branches. Model and vision-projector data total 279 MB, downloaded separately from block settings and verified with SHA-256. No API key or cloud fallback is involved.
A 64-bit ARM or x86 Android process is required. Short English yes/no questions are recommended; latency depends on the device. This model supplies no target coordinates or calibrated confidence score. Configure explicit action coordinates and validate your scenario on the device. Other models require a reviewed engine profile; compatibility is not assumed.
SmolVLM-256M · Apache-2.0(opens in a new tab)Versions and scope
- Schema 1
- Lua code with text, number, boolean and choice inputs.
- Schema 2
- Allowlisted descriptors for four engines already in the app. No new native code is loaded.
- Schema 3 · 1.0.51 reader
- Help text, field groups, numeric bounds, color, variable name, point and region for Lua blocks. A reader build supporting this schema is required; acceptance by older readers is not assumed.
- Schema 4 · 1.0.51 reader
- Embedded PNG icons, tabbed properties and atomic preset/reset buttons. Requires an updated reader build supporting this schema; older readers reject it.
Schema 3 is a prepared reader capability; this does not mean it is supported by the Google Play 1.0.50 baseline.
Packages are limited to 256 KiB and 24 inputs. This file is not a macro ZIP, webpage, APK, DEX or downloaded native library.
Author with MH AI or another assistant
Give the assistant the English brief, schema and an example. Request a complete JSON package; do not invent screen coordinates, permissions or undocumented APIs. MH AI offers structurally checked drafts as .mhblock downloads; it does not import or execute them automatically.
Security and distribution
The author and native.source fields are not signatures or publisher verification. Packages cannot elevate app permissions. Google Play policies still apply to interpreted Lua; this SDK does not certify Play compliance.
Google Play · Device and Network Abuse(opens in a new tab)