Closing floating Windows after a running a script-Python

Discussions concerning programming of SOFTIMAGE©
Post Reply
maxcrow
Posts: 12
Joined: 18 May 2012, 14:44

Closing floating Windows after a running a script-Python

Post by maxcrow » 04 Mar 2014, 10:32

Is there a python script that closes any open floating windows a script uses like the expression editor for example.
Thanks,
Max

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Closing floating Windows after a running a script-Python

Post by Hirazi Blue » 04 Mar 2014, 11:29

Don't know of any "ready-made" script, but this should be fairly easy to implement utilizing the view object and setting the view.state, especially if you already know which views your script has opened.
;)
Stay safe, sane & healthy!

maxcrow
Posts: 12
Joined: 18 May 2012, 14:44

Re: Closing floating Windows after a running a script-Python

Post by maxcrow » 04 Mar 2014, 17:17

Thanks Hizari,
That link helped and I have been informed by Andrew Hazelden http://www.andrewhazelden.com this may be the best way to do it

# Stop the PPG Windows from opening
Application.SetValue("preferences.Interaction.autoinspect", False, "")

AndrewHazelden
Posts: 12
Joined: 04 Mar 2014, 14:40
Location: West Dover, Nova Scotia, Canada
Contact:

Re: Closing floating Windows after a running a script-Python

Post by AndrewHazelden » 04 Mar 2014, 17:25

Hi Max.

Here is a python script example that will close a specific window:

Code: Select all

# Python Script - Close the Expression Editor window
def closeExprWindow():
  # Window States
  siNormal = 0
  siClosed = 1
  siMinimized = 2

  # Target Window Name
  targetWindowName = "Expression Editor"

  # Get the active window list
  layout = Application.Desktop.ActiveLayout
  views = layout.Views
  for x in views:
    if str(x) == targetWindowName:
      # Change the current window state to siClosed (1)
      x.State = siClosed
      print("The "+str(x)+" window has been closed")

# Close the Expression Editor window
closeExprWindow()

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 15:31
Skype: csaezmargotta
Location: Sydney, Australia
Contact:

Re: Closing floating Windows after a running a script-Python

Post by csaez » 04 Mar 2014, 21:43

There is a third argument on AddExpr() command to prevent the Expression Editor from appearing automatically (or use the OM) :)
http://download.autodesk.com/global/doc ... dExpr.html

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests