Page 1 of 1

*NEW* Beautify Moho file

Posted: Sun Feb 24, 2019 5:17 am
by synthsin75
https://sites.google.com/site/synthsin/ ... ects=0&d=1

This menu script will extract the current Moho file and beautify its formatting to make it easier to read. It will prompt you to save any changes to the file and where to save/what to name the beautified file.

This includes a python script, which requires you to have python installed on your computer.

It has been tested with Python 2.7, which you can find here: https://www.python.org/download/releases/2.7/

Re: *NEW* Beautify Moho file

Posted: Mon Feb 25, 2019 10:07 am
by Greenlaw
Thanks, Wes! Will check it out soon!

Re: *NEW* Beautify Moho file

Posted: Mon Feb 25, 2019 9:42 pm
by hayasidist
This was not working at all for me. Win 10 / 1803. Other than the prints I've enabled, there were no error messages - it runs but does not produce a .mohoproj

I have the .lua where it should be - and it shows up in the dropdown and seems to work - e.g. it correctly goes through the save / beautify as last saved loop
I enabled a couple of the print lines in the .lua

print (path) correctly identifies the destination .mohoproj
print (message.."python "..util.." extract -b "..file.." "..path) produces what would be expected from the code

the .py is in the script resources directory

I have installed and can invoke python - I can type (e.g.) help / modules and I do get the list of available modules.
====


A bit of detective work and …

replacing python with (in my case) C:\Python27\python.exe works.

The actual code change I made was os.execute("C:\\Python27\\python.exe "..util.." extract -b "..file.." "..path)

Re: *NEW* Beautify Moho file

Posted: Mon Feb 25, 2019 10:10 pm
by synthsin75
Huh, I don't remember if the Python installer I used added python to the system path (environment variable) or I did that manually.

You can run this to see if Python is on your system path:
print(os.getenv("PATH"))

If it isn't, I'll see about asking the user to find Python.exe if it's not found on the PATH...when I get the time.

Re: *NEW* Beautify Moho file

Posted: Tue Feb 26, 2019 5:57 am
by synthsin75
I've updated this (same link) to ask the user to find python.exe if it's not on the system PATH. If anyone uses this on Mac, it will probably need further updates, but it should be solid on Windows.

Re: *NEW* Beautify Moho file

Posted: Tue Feb 26, 2019 8:47 am
by hayasidist
thanks Wes. thinking back about when I installed python, there may well have been something about putting the executable somewhere else or even about path - but I just used the default options in the python installer.

Re: *NEW* Beautify Moho file

Posted: Wed Feb 27, 2019 2:14 am
by obtusity
On Python 2.7 (for Windows) adding the executable to the path was an option, but it was one of those old icons-in-a-tree-structure with a drop-down and "will be installed on local hard drive", and not the default.

In Python 3.x it's a more obvious checkbox, but unlike the rest of the Python install it requires admin approval (a little security speedbump which helps prevent random software adding a folder to the path with, for example, an alternative cmd.exe, notepad.exe, etc).

Re: *NEW* Beautify Moho file

Posted: Wed Feb 27, 2019 2:39 am
by synthsin75
Thanks for double checking, obtusity.