Is there a way to get the name of the file currently being worked on and the directory it is stored in?
I am working on a camera manager so I can just have a series of buttons to switch between camera views and am planning on storing the data in the same location as the file. All the examples I found use localize to save it in the script directory which seems problematic to me if you're ever handing off files.
File Directory/Data
Moderators: Víctor Paredes, Belgarath, slowtiger
-
- Posts: 13
- Joined: Mon May 15, 2017 11:51 am
- synthsin75
- Posts: 10253
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: File Directory/Data
moho.document:Path()
This will return the current file's complete path name. You can then remove the file name (moho.document:Name()) to find the directory.
This will return the current file's complete path name. You can then remove the file name (moho.document:Name()) to find the directory.
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
-
- Posts: 13
- Joined: Mon May 15, 2017 11:51 am
Re: File Directory/Data
Once again you are my personal hero, synthsin75.
- synthsin75
- Posts: 10253
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: File Directory/Data
Glad to help. 

- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
- hayasidist
- Posts: 3831
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: File Directory/Data
anthonytsb5 wrote:Is there a way to get the name of the file currently being worked on and the directory it is stored in?
I am working on a camera manager so I can just have a series of buttons to switch between camera views and am planning on storing the data in the same location as the file.
or simply append something like camera to the end ==> xxx.mohocamera or strip off the moho and replace it ==> xxx.camerasynthsin75 wrote:u can then remove the file name (moho.document:Name()) to find the directory.
and .. I'd love to see this script when it's finished!
- synthsin75
- Posts: 10253
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: File Directory/Data
Good point. Doesn't matter what the extension is, so long as your script knows the one to accept/look for.hayasidist wrote:or simply append something like camera to the end ==> xxx.mohocamera or strip off the moho and replace it ==> xxx.camera
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
- hayasidist
- Posts: 3831
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: File Directory/Data
a further thought -- if the camera stuff is only for the one project you might like to consider using MohoDoc:Metadata() see http://www.mohoscripting.com/index.php? ... ta&id=1014 rather than a file -- an example of managing such data is in http://www.mohoscripting.com/index.php? ... ta&id=1122
-
- Posts: 13
- Joined: Mon May 15, 2017 11:51 am
Re: File Directory/Data
Thanks, hayasidist. One last hurdle on the script but I'm hoping to upload it tonight/tomorrow so folks can take a look at take into into production on a short I'm working on this week.hayasidist wrote:and .. I'd love to see this script when it's finished!