Toggle Softimage Script Editor


This code toggles the Softimage script editor on and off. Useful to embed in a custom layout.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from win32com.client import constants as c
from win32com.client import Dispatch as d</code>
 
xsi = Application
log = xsi.LogMessage
collSel = xsi.Selection
 
def toggleScriptEditor():
oLayout = xsi.Desktop.ActiveLayout
collViews = oLayout.Views
oScriptEd = collViews("Script Editor")
 
if not oScriptEd:
oLayout.CreateView("Script Editor", "Script Editor")
return
 
oState = oScriptEd.State
 
if oState == c.siNormal:
oScriptEd.State = c.siClosed
elif oState == c.siMinimized:
log(oState)
oScriptEd.State = c.siNormal
 
toggleScriptEditor()