Following up on this thread: http://tech-artists.org/forum/showthread.php?3675-PyMel-3ds-Max-callbacks-like-functionality-in-Maya
I want to be able to trigger a script whenever the most recent line in the command history is, say, “polyEditUVs”. How can I get the command history from Maya without doing something like this?
import pymel.core as pm
fileLoc = "C:\\mayaCommandHistory.log"
pm.scriptEditorInfo(historyFilename=fileLoc, writeHistory=True)
fileHandle = open(fileLoc, 'r')
fileLines = fileHandle.readlines()
print fileLines[-1]