Script directory

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

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

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

Script directory

Post by strider2000 » Wed Nov 18, 2015 6:01 am

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.
My new website (just getting started) | M1 Characters for Moho
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script directory

Post by synthsin75 » Wed Nov 18, 2015 6:14 am

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: 443
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script directory

Post by strider2000 » Wed Nov 18, 2015 11:53 pm

Great. Thanks synthsin75!
My new website (just getting started) | M1 Characters for Moho
Post Reply