Script directory

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Script directory

Post by strider2000 »

What is the best way to get the path to the script directory without going through the file open dialog?

I have a script that I want to read from a text file, but I don't want the file open dialog to come up. I know I can use absolute path for my environment, but if I want to share the script with others they'd have to tune it for their system. I'd like the file to be in a location like the same location as the menu script or in the utility directory/folder. I have seen it work with a relative path, but it seems that may be kind of lucky, because it wasn't working for a while until I set the absolute path first. So it seems like it was caching the last accessed directory.

Thanks for any help.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script directory

Post by synthsin75 »

moho.UserAppDir() will give the path to the users custom content folder, and you can concatenate that with the specific place in the custom folder that you want to user to install the files.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script directory

Post by strider2000 »

Great. Thanks synthsin75!
Post Reply