app.command.RunScript HELP

I want to add a button to the touch tool bar that runs a script, but can’t figure out how to use app.command.RunScript() any help would be greatly appropriated.

Local dlg=Dialog(“RunScript”)
dlg

:button{text=“Run”,onclick=function()dofile(‘C:/program files/aseprite/script/ whatever the script name is.lua)
end}

:show{wait=false}

Just make sure the little slashes are in the opposite direction when you write in the directories

I hope that’s what you’re looking for :wink:

1 Like

That works, thank you much.

Any way I can make the path relative to the default scripts folder?

No sorry I’m not too sure how get its app pathway
I am trying numerous ways but have yet to found one if you find out that would be great
help

Hi @Jessica8D , @stick,

I think you can use a dot followed by a forward slash, dofile("./myfile.lua"). Two dots to go up one directory.

I tried adding the ./script.lua
But I just get can’t cannot find directory
Do you know if it gets it from its own path of the script or The path of aseprite then the script folder
Just not too sure where to start from

I tired “./” but it didn’t work, so what I wound up doing was:

adding a local var at the top to get the Appdata folder and then build the rest of the path:

local AsepriteScriptsFolder	= os.getenv('APPDATA') .. "/Aseprite/scripts/"

and then added that to my file call:

dofile( AsepriteScriptsFolder .. 'MyScript.lua')