Dennis Leong
03-20-2008, 03:18 PM
I'm not sure if this is possible, and I've scoured the SDK docs to find a way to do this but I'm out of ideas.
What I'd like to do is write a plugin so that when a scene is saved all the text in the script history window gets written to an annotation in the scene root. This would make it easier to troubleshoot scenes when something goes awry and the animator can't remember what they did since the last save. We have a custom save manager to write iterations of scenes so I don't have to worry about overwriting the previous annotations.
As far as I can tell, I can only retrieve selected text in the script history window using the View.GetAttributeValue("historyline") command. The SDK docs state that if there is nothing selected then the function will return the last script history line, although I only get an empty string when I do this.
Here's my bit of code (vbscript) to create the script history view and then spit back out some text (in this case, an empty string because nothing is selected in the script history window.)
' Get the view if it exists, or create it.
dim view : set view = Desktop.ActiveLayout.Views("Script History")
if typename(view) <> "View" then set view = Desktop.ActiveLayout.CreateView("Script History", "Script History")
' Grab the selected text in the script history view. If no text is selected, the function
' is supposed to return the current script history line (it doesn't seem to do that.)
dim historyText : historyText = view.GetAttributeValue("historyline")
' Output the text we grabbed.
MsgBox historyText, vbOKOnly, "Script History Text"If you ran this without a script history window open, it will create a script history window for you and probably output nothing. If you select some text in the script history window and run the code again, the vbscript message box will report the selected text.
So my question is: can I can get ALL the text in the script history window without asking the animator to manually select the entire script history?
I know I can set XSI preferences to log all script commands to an external file, but this file gets replaced once a new XSI is loaded (and I don't know how this works if multiple XSIs are loaded.) I've tried opening the script log file and reading from it to grab the info I need but the file is locked when XSI is still running.
I'm running XSI 6.5 on win32. If anyone has any ideas, please post!
What I'd like to do is write a plugin so that when a scene is saved all the text in the script history window gets written to an annotation in the scene root. This would make it easier to troubleshoot scenes when something goes awry and the animator can't remember what they did since the last save. We have a custom save manager to write iterations of scenes so I don't have to worry about overwriting the previous annotations.
As far as I can tell, I can only retrieve selected text in the script history window using the View.GetAttributeValue("historyline") command. The SDK docs state that if there is nothing selected then the function will return the last script history line, although I only get an empty string when I do this.
Here's my bit of code (vbscript) to create the script history view and then spit back out some text (in this case, an empty string because nothing is selected in the script history window.)
' Get the view if it exists, or create it.
dim view : set view = Desktop.ActiveLayout.Views("Script History")
if typename(view) <> "View" then set view = Desktop.ActiveLayout.CreateView("Script History", "Script History")
' Grab the selected text in the script history view. If no text is selected, the function
' is supposed to return the current script history line (it doesn't seem to do that.)
dim historyText : historyText = view.GetAttributeValue("historyline")
' Output the text we grabbed.
MsgBox historyText, vbOKOnly, "Script History Text"If you ran this without a script history window open, it will create a script history window for you and probably output nothing. If you select some text in the script history window and run the code again, the vbscript message box will report the selected text.
So my question is: can I can get ALL the text in the script history window without asking the animator to manually select the entire script history?
I know I can set XSI preferences to log all script commands to an external file, but this file gets replaced once a new XSI is loaded (and I don't know how this works if multiple XSIs are loaded.) I've tried opening the script log file and reading from it to grab the info I need but the file is locked when XSI is still running.
I'm running XSI 6.5 on win32. If anyone has any ideas, please post!