Multiple windows on startup

Posted by Gdiakcl on Thu 09 Apr 2015 10:31 AM — 3 posts, 14,637 views.

#0
I would like to be able to save my session (with 2 windows open and sized where I like them) and be able to load that session on startup. Is there a setting in MUSHclient to achieve that effect?
Australia Forum Administrator #1
Template:function=MoveWorldWindowX
MoveWorldWindowX

The documentation for the MoveWorldWindowX script function is available online. It is also in the MUSHclient help file.



That should let you move and resize all of your windows to your desired position (run that at world open - there is a provision for running a script when the world opens, see the Scripting configuration tab).

You could make a script file, and put the appropriate function into it.

Template:function=GetWorldWindowPositionX
GetWorldWindowPositionX

The documentation for the GetWorldWindowPositionX script function is available online. It is also in the MUSHclient help file.



The above gets the world window positions which you could run at world close, to remember the current positions.


This isn't a "setting" per se, (although the main window should be remembered).

These days I would recommend using Miniwindows to achieve extra panes of information.
Australia Forum Administrator #2
Something like this ...

Make a script file called, say, move_world_windows.lua.

Inside it put this:


function load_window_positions ()
   --                                 Left, Top, Width, Height, WhichWindow
   DoAfterSpecial (1.5, 'MoveWorldWindow (1, 1, 860, 818, 1)', sendto.script)
   DoCommand "NewWindow"
   DoAfterSpecial (2, 'MoveWorldWindow (870, 1, 400, 818, 2)', sendto.script)
end -- save_window_positions 


In the world configuration -> Scripts make the above file your script file (browse for it).

Then in the World Events -> Open (same configuration page) put the word: load_window_positions

Save your world.

Now if you close and re-open the world both windows should open (after a brief pause) and reposition to where the script said.

To customize the numbers, just do it by trial and error, or position the windows how you want, and then use the Immediate scripting window to do this:


require "tprint"

print "------- main window ------"

tprint (GetWorldWindowPosition (1))

print "------- other window ------"

tprint (GetWorldWindowPosition (2))


You should see some numbers in the output window like this:


------- main window ------
"top"=1
"height"=818
"left"=1
"width"=860
------- other window ------
"top"=1
"height"=818
"left"=870
"width"=400


Use those to set the appropriate values in the script.