Opening one script with another

I tried using the app.command.RunScript command from inside my master script, but it doesn’t load the slave script, and there is no documentation on how this command works.

Is there a way to open one script from inside another?

Basically, I need to make a modular dialog box, and seeing as the dialog boxes are static in layout once the script is loaded, I think it would probably take feeding variables from one script to the other upon opening to have a truly modular dialog box.

Is there something I am missing about app.command.RunScript, or is there a better way to make a modular dialog box?

It’s an interesting case, the code for this command can be found in the Aseprite’s repository on GitHub.

It seems that you could pass any arguments to the RunScript command with one of them being filename - either an absolute or relative (starting from local folder for scripts) path to LUA script.
All additional arguments would be passed to the script as well so an example use case would look like so:

app.command.RunScript{
   filename="./Resize.lua",
   width=100,
   height=200
}

And It looks like a great tool for building complex scripts or extensions but… I can’t get It to work either. :expressionless: Not even a bit, If I understand the C++ code there It should prompt user with an alert before actually launching a script and It doesn’t happen.
Perhaps this command somehow is for use only as a CLI argument? (From CLI docs It looks like you can run scripts with aseprite --script "script.lua").

1 Like

Hi there! To organize the code in a modular way, I would recommend you to use dofile() instead of app.command.RunScript() (generally app.command.* are intended for the menus).

You can have the common code in other .lua and use dofile('./.hidden/my-functions.lua') to include a set of functions that can be used in your main .lua.

2 Likes

@thkwznk Welcome! What a great entrance into the community!

Anyway, I, too, noticed that the command merely opened a blank dialog. But, I put a pin in that option as I found a better way to accomplish my goal.

@dacap I’m truly interested in deepening my knowledge of the scripting API. So, even though I’m not currently implementing parent/child scripts, thank you for your insight.

1 Like