Running this sort of thing is probably better done using TeXShop's "engines" instead of calling an applescript from the Macro Editor.
If you look in your
~/Library/TeXShop/Engines folder (especially the
Inactive folder) you can see various examples of such engines. The engine files themselves are just shell scripts (so they need to have the executable bit set) Once you've got the script working you can put it in the
Engines folder and it will appear in the pulldown menu beside the
Typeset button on any document window.
It's very possible that the script you want to run already exists (you mention glossaries). Have your looked at the
LaTeXmk engine for TeXShop?
The LaTeXmk script (various versions are found in the
Inactive folder; just drag them to the
Engines folder and restart TeXShop to activate them.) runs all of the required numbers of
latex/bibtex/mkindex/makeglossaries etc. so that everything in your document is complete. It knows about most of the major packages' extra .aux-type files, and is quite smart. The LaTeXmk engine is maintained by Herb Schulz and the latest version can be obtained from his web page.
One thing to watch out for when running scripts from within an application is that the path and environment variables set inside the application are not identical to the path and environment variables you may have set in you bash
.profile or csh