Dave Girard's 101 Autodesk® Maya® Tips is now available in Kindle, interactive iPad edition and DRM-free EPUB/PDF editions. Work faster, cry less. Read more about the ebook.




Follow cgbeige on Twitter

Topics by tag:



Recently published articles by Dave G:



Free downloads by Dave G:



Mac OS X-only downloads:

Grab my Maya Crash File opener for OS X 10.6 and up

Update: If you grabbed the very first version posted, you might have a problem with this not working after November. I had forgot to replace an “N” with a wildcard so it would work year-round. The file is updated now to fix it and it’s the same link. At the bottom of the post is a post to talk about what the script does, for people looking to understand the UNIX script inside the Service. 

I just made an OS X Automator action to open Maya files after it crashes. 

Grab it here. Install instructions are inside the zip file. Note that the script will open the newest version of Maya on your machine. If you want another version of Maya to open the file, launch the application and then run the Service. It will open in the running copy of Maya.

I’ll break down the parts of the script, for people who want to learn UNIX (the Service just runs this shell script):

cat /var/log/system.log | grep "Fatal Error" | tail -n 1 | sed 's/^[^\/]*//' | xargs open

cat reads the log, pipes ( the | ) it to grep, which finds all lines with Fatal Error in it (Maya crashes), pipes it tail which then takes only the last line (last crash), pipes it to sed. The sed application is a find/replacer that is using a regular expression to find the term. A regular expression is commonly used in UNIX to find matches like this. sed is searching and replacing (the “s” is the find replace command) for the first part (/everything in here/), which translates as:

^starting at the beginning of the line… [^\/]* find the shortest match possible until it reaches a / character and replace that match with nothing (the lack of anything between the two slashes //). That strips out all the crap up until the path to the file (/var/tmp/yadda/file.ma) and the last portion of the script then sends this output as input to OS X’s open command, via xargs, since you can’t send standard input to open. Open acts as a double-click, and it’s pretty awesome.

If you want a good regular expression editor while you’re trying out some, here’s one:

http://www.macupdate.com/info.php/id/24078/reggy

It saves having to run your command just to test the regular expression. If you want a good book to learn UNIX for OS X and regular expressions, I’ve been using this book.

It’s really nice having technical manuals on the Kindle, since I just use the Kindle Mac app when I need help for stuff like this.

2 notes | Permalink

  1. marktomlinson reblogged this from polygonspixelsandpaint
  2. polygonspixelsandpaint posted this