ScriptSpot

Script

Give me back my dialogs!

By LoneRobot · Credited author: Lonerobot · 2010-03-16

Version
2.4.2
Version requirement
Max 2010/2011/2012
Date updated
2012-11-14
Votes
320
Download
Download
Description

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

Attachments

Tags: maxscript, lost, DotNet, lonerobot, WindowBox, Dialog, Dialogs

Comments (42)

Works perfectly

ivailora4kov · 2022-02-17

This Script is very useful. Especially when you have multiple monitors and some of the menus dissapears if you turn of one of them. Thanks to the author of the script

Easy fix

savascetin · 2021-08-19

open in any text editor then replace all instances of "#scripts" with "#userScripts"(without the quotes).

To those with GDI+ error

damard · 2019-02-25

Make sure you run 3dsMax as administrator when first running the script, as it will create Folders/Files in the #scripts folder.

WindowOps.WindowPosition and Windows taskbar on the left/top

tasurnin · 2018-06-06

Hello,

I just finished a script that save all the positions of my "popup dialogs" so each time I restart max the dialogs go back to their positions.

I also use WindowOps.WindowPosition to get their position but because my windows taskbar is on the left side of my screen. There is an offset between the position I get through WindowOps.WindowPosition and getDialogPos().
I could use that offset if I only had 1 screen. But as soon I have 2 screens and that the taskbar is not at the same position on the second screen, i'm f***. ^^

Hiding the taskbar when I saved the position could be the solution, but it's really slow with hiddenDosCommand.

Do you have any idea how to fix my issue?

By the way, your script is really nice. ;)

Joachim

Not work 2017

tomy3d · 2017-04-25

As well says in the explanation, works at max until the 2012 version. A pity. I hope it updates. a greeting

where can I find icons?

dimwalker · 2016-06-03

Script can't find png files.
I'll try to create placeholders for now, but feel like I'm missing something - script doesn't install any files, but tries to reach it.

Thnx 4 nothing

Podmentor · 2014-06-30

Happy users of Windows 7 can do this much more easier, for u can just simply press windows button on your keyboard and left or right arrow (considering that yor window is active at this time). Learn Russian and read our forums. From Russia with love =) "хароший скрипт, интересный"...

Thnx 4 trolling

LoneRobot · 2014-10-30

If you can't see your window, how do you know if it is active? This script makes finding any dialog tied to max easy. If you can't see the application of the script, then you've obviously not had this issue.

Problem

Phokka · 2014-03-05

This appears when press winbox button

Attachments

Anubis · 2012-11-14

thanks

thanks

LoneRobot · 2012-06-27

glad you found it useful, john

JokerMartini · 2012-06-27

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

This script has been very useful.

MLB · 2012-06-25

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.

Answers, of sorts

LoneRobot · 2012-06-25

- 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

LoneRobot · 2012-06-24

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 · 2012-06-25

Thanks alot, that did it.

Hi Pete,this script has been

br0t · 2012-06-21

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

Monitor Issue

LoneRobot · 2012-11-14

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

Thanks for tool

Kstudio · 2011-08-12

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.

LoneRobot · 2011-08-13

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

LoneRobot · 2011-08-08

Hi wannabeartist, azzaelle

Thanks for your comments and I'm glad you have found it useful.

Pete

Download Link on your Site links to outdated Script

spacefrog · 2011-08-10

Hi Pete

Just wanted to give you a hint that when i DL from your website's DL page, i still get the 2.1 build...Might be pretty confusing for people visiting your website...

In other news.... thanks for this great little tool ;-)

Thanks Spacefrog, I'd

LoneRobot · 2011-08-11

Ta Josef, I'd forgotten to update my blog. Thanks for letting me know. Pete

Thank you!

wannabeartist · 2011-07-27

This is just what I need and I wasn't even looking for it (saw it on facebook's feed!)
I had lost my "exit isolation mode" dialog for couple of days, thanks to switching on a smaller display - it was crazy-complicated modeling without it - thanks so much for bring it back!

Thanks Lone Robot

azzaelle · 2011-06-08

Thanks LoneRobot! I was searching for help in the same problem and i foun your comment as an answer!

tassel · 2011-06-02

Nice to see you finnaly upgraded/fixed the script. Now it works with my 2012 installation. I just love it :D

LoneRobot · 2011-06-02

Cheers, Raymond. Glad to see the 2012 users can make use of it now.

Some windows not listed? Try this.....

LoneRobot · 2011-06-01

Please see the update to fix any window ommisions you may be seeing on x64 systems

Attachments

lightcube · 2011-05-01

Any chance to update this for Max 2012? I got this message when trying to run it in 2012:

-- Error occurred during fileIn in #W:\plugins\MaxScripts\LoneRobot-Windowbox.mcr; line number: 310
-- Error occurred in anonymous codeblock; filename: W:\plugins\MaxScripts\LoneRobot-Windowbox.mcr; position: 14169; line: 310
>> MAXScript FileIn Exception:
-- Runtime error: dotNet runtime exception: C:\Program Files\Autodesk\3ds Max 2012\ui\Ribbon\Icons\Modeling\properties.ico <<

Updated!

LoneRobot · 2011-05-21

Hi, this should not error any more as I have removed the icon dependencies from the script. They are now dynamically built at runtime the first time the script is run. cheers!

W DIGITAL · 2010-04-22

ok, had to change resolutions a couple times of 2 dipslalys
now i have it

W DIGITAL · 2010-04-22

great script!
but please tell me or help me,
how i can i bring back my render progress dialogue
i installed a different max theme, and now its gone!
not nice

please help

LoneRobot · 2010-03-19

Hi Martin,

You are welcome, i'm glad you find it useful.

Re script update - That's awesome - I am currently updating my script to incorporate your suggestions.

There is a dotnet class to get monitor information, so I can now add functionality to arrange the highlighted dialog on the second monitor (which generally how i work)
I thought ( a bit like windows 7) you could keep the dialog width but maximise along the height so you get the largest possible dialog - for things like the material editor and listener i think this would work nicely.

this is the working struct to handle the monitor data -

Struct MonitorInfoStruct
(
MonitorOps,
Primary,
Secondary,
Count,
SecondMonitorPresent,
PrimaryBounds,
SecondaryBounds,
PrimaryWorkingArea,
SecondaryWorkingArea,

on create do
(
MonitorOps = (dotnetclass "System.Windows.Forms.Screen")

Count = MonitorOps.AllScreens.count
SecondMonitorPresent = if Count > 1 then true else false
Primary = MonitorOps.primaryscreen

if MonitorOps.AllScreens[1].Primary then
(
PrimaryWorkingArea= MonitorOps.primaryscreen.WorkingArea
PrimaryBounds= MonitorOps.primaryscreen.bounds
)

If SecondMonitorPresent then
(
Secondary = MonitorOps.AllScreens[2]
SecondaryWorkingArea= MonitorOps.AllScreens[2].WorkingArea
SecondaryBounds= MonitorOps.AllScreens[2].bounds
)
)

)

MonitorInfo = MonitorInfoStruct ()

MonitorInfo.Count
MonitorInfo.SecondMonitorPresent
MonitorInfo.PrimaryWorkingArea.width
MonitorInfo.PrimaryWorkingArea.height
if MonitorInfo.SecondMonitorPresent then
(
MonitorInfo.SecondaryWorkingArea.width
MonitorInfo.SecondaryWorkingArea.height
)

MarTroYx · 2010-03-19

this is some updated one I'm using, I the mean time , I've done one where checking the checkbox hided the windows so I can see what below , let say a movie but seam visible property is not guaranty to be true right away so I just removed this functionality ...cheer :-)

Martin

Attachments

MarTroYx · 2010-03-19

Hi Pete,

yes I think you can set style to maximized if I remember well, that would a be nice feature indeed !
another thing you might add but I let you see if it worth it , I done this in little one I posted when I double click listener it clearlistener or when I doubleclick render windows it render ... thing like that :-)

I also wanted to take this opportunity to thank you for your great base64 image utility, I really like it and I also have a feature request for this one ... if you ever plan an update please let me know :-)

Best regard,
Martin

LoneRobot · 2011-05-25

I also wanted to take this opportunity to thank you for your great base64 image utility, I really like it and I also have a feature request for this one ... if you ever plan an update please let me know :-)

Hey Martin, I'm sorry I didnt spot this before, Please feel free to send a feature request via my blog and I'll look into it for you. 

LoneRobot · 2010-03-18

Hi Track! thanks for you comment.

Martin - that is great, another couple of useful API methods. I was thinking that it would be good to have a kind of 'compact' mode where you could toggle the window states like in your script - you could dock it and then just click when you want the window to be focused/maximized. I also though i might add the max custom icons to each window type to show what it is when in compact mode.

I was wondering about methods to work out second monitor configurations/coordinates, it would be nice to click a window and have it hide all the other floating windows, and maximise the current selection on the second monitor.

Kstudio · 2010-03-18

Thanks, Pete!
Now is not headache:)

Nice tool, Martin!

MarTroYx · 2010-03-17

Hi Pete,

Today I played a bit to get the thing I was talking working as I really wanted it :-)... I wanted to add it to your, but since I'm not very proficient with vb( just can't get it with the dim thing:-) I just made one from scratch just to illustrate the kind of feature I wanted ... I think it would be cool with a nice interface like your

Martin

Attachments

peaceman · 2010-03-17

great tool! i wish i'd be running on max9 64...

MarTroYx · 2010-03-17

Nice tool Pete,
maybe an option to make them visible/unvisible and when you click on one, it hide all the other so I can put all dialog full size on my second screen , sort of dialog switcher :-)

anyway, thank for sharing,
Martin

LoneRobot · 2010-03-17

Hi Martin,

thanks for your comments! That's a good idea - This started as a piece of research and kind of grew, so so i wasnt sure what sort of extra functionality i wanted. I'll look into your suggestions as it would be nice to not have to keep focusing and resizing the extra dialogs. Cheers, Pete