Sunday, March 29, 2015

Open Maya from terminal to run Environment Variables



Basically, if you edit your environment variables on OSX, maya won't necessarily run them on auto when you start it if you have special entries in there. I have a few relating to Fabric Engine and starting up.


This script runs terminal, opens your environment variables and runs maya with those specific variables, then it kills terminal.


After editing your maya env variables fiel, you would use this in apple script. I went as far as making a shortcut/alias to it and placing it in my doc to replace the regular maya alias in my doc. I edited the env file with sudo nano to make sure the changes stuck.




--try
--open terminal
tell application "Terminal"
activate
delay 0.8
--run maya env variables
do script ". /Applications/Autodesk/maya2014/Maya.app/Contents/bin/MayaENV.sh"
--keystroke ". /Applications/Autodesk/maya2014/Maya.app/Contents/bin/MayaENV.sh"
tell application "System Events"
keystroke return
delay 1
--start maya
keystroke "open /Applications/Autodesk/maya2014/Maya.app"
keystroke return
delay 8
--kill terminal
set BunchaAppsProcesses to {"Terminal", ""}
tell application "System Events"
repeat with BunchaAppsProcesses in BunchaAppsProcesses
set BunchaAppsProcessUnixID to (unix id of processes whose name is BunchaAppsProcesses)
try
do shell script "kill -9 " & BunchaAppsProcessUnixID
end try
end repeat
end tell
end tell
end tell
--end tell
--end tell
--end try

No comments:

Post a Comment