Skip to content

Export and import scripts / Hm05Script / ImportApi

Interface: ImportApi ​

Properties ​

PropertyTypeDescription
buildobjectwhat the import adds (applied together when run() ends)
build.image(spec) => stringa Library picture; returns a handle for elements
build.markerType(spec) => stringa marker type (skipped when one of that name exists); returns the name markers use
build.symbol(spec) => stringa Library symbol; returns its (unique) name
docobjectthe open document, read only
doc.fpsnumber-
doc.markerTypes() => MarkerTypeInfo[]-
doc.symbols() => string[]Library symbol names
filesobjectOther files, by a path relative to the picked file's folder ("../pics/a.png") — or absolute on the desktop. Reading outside the picked file's folder asks the user first (desktop); the browser asks the user to pick the folder that holds them.
files.exists(path) => Promise<boolean>-
files.read(path) => Promise<Uint8Array<ArrayBufferLike>>-
files.text(path, encoding?) => Promise<string>-
imageobjectpicture helpers
image.size(bytes) => Promise<{ height: number; width: number; }>width / height of PNG / JPEG / GIF / WebP bytes
inputobjectthe file the user picked
input.namestring-
input.pathstring | nullthe full path on the desktop; null in the browser
input.sizenumber-
input.bytes() => Promise<Uint8Array<ArrayBufferLike>>-
input.text(encoding?) => Promise<string>decoded text (default utf-8)

Methods ​

log() ​

ts
log(...values): void;

shown in the dialog's log (console.log does the same)

Parameters ​

ParameterType
...valuesunknown[]

Returns ​

void


progress() ​

ts
progress(done, total): void;

the dialog shows done / total

Parameters ​

ParameterType
donenumber
totalnumber

Returns ​

void

HereSplash — 2D animation for the web