Save and open from Macro Window

… as the title says. what about that? it’s a bit of a hustle to always copy the code back and forth to 3rd party editors just of opening, editing, testing, and saving. don’t you agree?

The macro window is only meant for small scripts. If you need it more then once, put it in a file in the Script folder. You can open the script in a editor, and it will always use the latest version from diet if you run it. And you can use the cmd+opt+R shortcut to run it.

i see. sometimes you wanna use a script over and over again. crawling through all the file menu gets longer (what’s the opposite of scripting’s purpose). so in that case you have to open the scripts folder, open the script in an external editor, copy it to the macro window (since it will »just« remember your last manually put code) and run it like you said.

quite a procedure.

do i overlook something? i am aware of everything you wrote, georg. but do you get my point?

So you like to store a bunch of snippets in the Macro window?

What kind of scripts are that?

i actually meant a save as .py function. you know, right at the spot, where the user is also writing his scripts: in glyphs’ macro window. and also a simple open. but your suggestion sounds also good. maybe like a handfull of favourites or so? just for the few scripts, that you use over and over.

for instance from Mekkablue’s collection:

  • »remove images« (i try to figure out how to rewrite it to apply on all layers and the whole font)
  • all of the path scripts like distribute nodes, rotate, bump, etc

and some of my scripts for dealing with paths or opening tabs with certain test-strings (based on selected glyphs).

I think it is much more convenient to edit the scripts from the scripts folder and run them from the menu. The script writing facilities of editors like TextMate are much better then the macro window. So as I said the macro window is better for really small scripts that you probably don’t need again.
And you can assign keyboard shortcuts to scripts (in the system preferences).

And you can use folders to organize your scripts in the script folder.

oh i see your point.Will try that workflow, sounds good.

and the shortcut tip made my day anyway! thanks, that is awesome.

still i wonder how the process is, when building a script. now that i try to write a code in text wrangler (which is saved as a .py in the scripts folder) i have to run it from the glyphs menu, each time i wanna run & try. and i cannot see the print output, unless i put the code back to the macro panel.

how can i directly run it in glyphs? running in the editor doesn’t make sense. how you guys develop the scripts?

You save the script it in the Scripts folder.

You need to add a “#MenuTitle:” + “the name of the script” in the first line. (Have a look in the scripts form my github.

Then click the script menu, press the option key and the last entry will change to “Reload Scripts”. Click that. The script will show up in the menu. If you select the menu entry, Glyphs will run the script. All output will be in the macro window.

If you change the script (in TextWrangler or TextMate) you can come back to Glyphs and hit cmd+opt+R to run the last script again.

thanks for the link, i am aware of that. okay, this might work with cmd+opt+R, didn’t know that the output will still be refreshed (is a bit confusing if you see a total different script above the output window of the macro panel.

but good, i think this will do it, thanks guys

The new Macro Panel in Glyphs 3 is really cool!

Now that this …

… is no longer true, can I re-iterate the request to allow opening scripts (.py files) right in the Macro Panel? You know, just like in FontLab 5. :wink:


The macro panel will be much better very soon.

1 Like

While you’re working on it, I think it’d be intuitive and parallel to the main Glyphs window if Cmd-W would close the current tab in the macro window if it’s active, rather than the window itself.