Give me back my dialogs!

320 votes
Version: 
2.4.2
Date Updated: 
11/14/2012
Author Name: 
Lonerobot

Window box is a script (and tutorial) to show you how you can use Dotnet and Win32 methods to get back dialogs you have lost from using multiple monitors.

UPDATE 2.4.2

Fixed an issue with monitor data, it now centers correctly on all screens. Sorry for the delay in finding that one. 

Additional Info: 

Previous Updates :

 

UPDATE 2.4.2

Fixed issue with monitor data, now centers correctly on all screens. 

UPDATE 2.4

Fixed a bug that errors with the SME interface pre max 2011 

 

Update -V2.3

UPDATE 2.3 

Oh Alright, I added Slate Material Editor Support. It's a bit sketchy, it doesnt seem possible to return a Window handle for SME so you have to set it via the MXS interface. The resize is not currently working with the Datagrid, but the Reset to [0,0] works fine, which is probably what most people need. 

I have also fixed a bug - the Base64 function built the icons wrong, the close button should be on the far right. If you delete the icons from the Scripts/lonerobot/assets/icons folder then they will re-build correctly at runtime. 

Slate Material Editor reset added 

UPDATE - V2.2  

Just to note - getpoupdialogs() does not seem to return all of the floating dialogs present in a session of max. This is a change in behaviour from when I originally wrote the script (as the original screenshot will testify, yet since I upgraded to Win7 x64, the same command does not return these windows) You can get a better result in the script by changing the line -

DialogList = for i in (UIAccessor.GetPopupDialogs()) where not i == 0 collect i

to -

DialogList = for i in (windows.getChildrenHWND 0 parent:#max)

           where UIAccessor.IsWindow i[1] and (not i[5] == "AdApplicationButton") and (not i[5] == "") collect i[1]

This seems to give a better result on my Win7 x64 build. I didn't get this issue on vista 32bit so could be something to do with that. With this line it will now list the layer manager, material editor and render dialogs. It does return some toolbars which may or not be required, but better to be more complete than miss some. You can change the original script or download the updated code (version 2.2)

As you can see from the new screenshot, it's not missed any this time, well maybe the Slate Material Editor, but who uses that eh? :-) 

UPDATE - V2.1

 The script has now been updated to remove the dependencies on the ribbon control icons. These have now been integrated into a Base64 encoded string, and builds them automatically when the script is first run. This should remove any icon errors you are seeing (in Max 2012 for example) Window box is a script (and tutorial) to show you how you can use Dotnet and Win32 methods to get back dialogs you have lost from using multiple monitors.

 

LoneRobot

Version Requirement: 
Max 2010/2011/2012
AttachmentSize
lonerobot-windowbox2.2.mcr18.03 KB
lonerobot-windowbox2.3.mcr20.84 KB
lonerobot-windowbox2.4.mcr20.93 KB
lonerobot-windowbox2.4_1.mcr21.18 KB
lonerobot-windowbox2.4_2.mcr21.6 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
LoneRobot's picture

Monitor Issue

Hi Pete, this script has been a lifesaver for me as I work on a laptop with multiple screens a lot, thank you for it! Now for some reason, it does not start for me anymore, giving me this error message: http://img201.imageshack.us/img201/2679/winboxerror.jpg Any idea whats wrong? I need to get tham damn MassFX Tools window back ...

This issue should now be resolved, Thanks. Please download version 2.4.2

LoneRobot's picture

thanks

glad you found it useful, john

JokerMartini's picture

This script has saved me

This script has saved me quite a few times. Thanks Pete.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

LoneRobot's picture

Answers, of sorts

- Is it possible to expand this script so it will place a window/dialog at a preset position instead of at (0,0)?

Yes - Just type the position in the xpos or ypos columns in the datagrid

Maybe integrate your script in the Max UI as a window opener/closer or mode switcher.

That's not how I use it - its just to rescue lost dialogs -

Lastly is it possible to lock a dialog/window in place? I keep on accidentally moving them.

This should be possible by script - Just store the last location and restore it on mouseup with setdialogpos

MLB's picture

This script has been very useful.

I have a dual monitor setup with the right monitor in portrait mode. Max doesn't like this.

- Is it possible to expand this script so it will place a window/dialog at a preset position instead of at (0,0)?

- Maybe integrate your script in the Max UI as a window opener/closer or mode switcher.

- Lastly is it possible to lock a dialog/window in place? I keep on accidentally moving them.

br0t's picture

Thanks alot, that did it.

Thanks alot, that did it.

Never get low & slow & out of ideas

LoneRobot's picture

Hi, Someone reported this to

Hi,

Someone reported this to me a while back and I was unable to replicate the issue on my system. It was to do with the small piece of code that uses a dotnet method to get the primary monitor. It's not really a core part of the script. You can comment out the final lines except the one starting with createdialog and the script will work just as before.

br0t's picture

Hi Pete,this script has been

Hi Pete, this script has been a lifesaver for me as I work on a laptop with multiple screens a lot, thank you for it! Now for some reason, it does not start for me anymore, giving me this error message: 

http://img201.imageshack.us/img201/2679/winboxerror.jpg

Any idea whats wrong? I need to get tham damn MassFX Tools window back ... Cheers

Never get low & slow & out of ideas

LoneRobot's picture

Hi Track, Thanks for the

Hi Track,

Thanks for the tip. I do a lot of my coding within structs as it gives me an organised way of referencing the data that each script handles. So it pretty much goes in a struct regardless and keeps the variable and function scope local.

The icon struct at the start of this script would ordinarily be run as part of max startup, but since it only creates icons if they do not exist, this would only run once anyway. I packaged it this way so that people could take the struct and replace the base64 strings with whatever they liked, thus allowing them to deploy scripts without icon dependencies.

cheers,

Pete

Kstudio's picture

Thanks for tool

Small tip
For starting maxscript on 3ds max 2009 you can place all variables and function from struct (on the top of the script) without struct.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.