Page 1 of 2

Remember and recall window positions...

Posted: Wed Sep 01, 2004 12:16 am
by Kale
Because i like nice tidy desktops i've written a very small utility to help me keep all the server displays (open windows) nice and neat at work. It works nicely and contains a few nice procedures.

To add a window(s) to the list just click 'Add...' then click on the windows titlebar or you can click 'Add all windows' to add the lot! You can also pass the string '-tidy' as a program parameter to just move and resize all previously captured windows or the program parameter '-record' to record new or update exisisting windows without opening the GUI. Click the window button (in the middle of the arrows) to resize the windows to the captured settings too. Click the screenshot to download.

Image

of course, critisism and/or improvements are most welcome. :)

Posted: Fri Sep 03, 2004 2:21 pm
by ebs
Kale,

I like it! :D

It took me a minute to figure out how to add a window, but I got it.

One suggestion: set the #PB_ListIcon_FullRowSelect flag on the
Captured Windows ListIcon Gadget. It makes it a lot easier to select
a window name from the list, especially if the name is short.

One really handy addition would be a "Capture All Open Windows"
command and/or button, so you can take a "snapshot" of the user's
desktop without having to add the windows manually. Do you have
code to enumerate all open windows?

Regards,
Eric

Posted: Sun Sep 05, 2004 11:36 pm
by techjunkie
Yeah! :D I like it too... neat and handy...

Posted: Mon Sep 06, 2004 12:18 pm
by Kale
One really handy addition would be a "Capture All Open Windows"
command and/or button, so you can take a "snapshot" of the user's
desktop without having to add the windows manually. Do you have
code to enumerate all open windows?
Good idea! I'll see if i can find anycode like that around here. :)

Posted: Tue Sep 07, 2004 5:19 am
by Beach
This is really cool Kale. It would also be nice if you could move all windows out of the way like Apple's OS X does. When you move your mouse to a certain spot on the screen, all of the open window move out of the way so you can see the desktop. Just a thought.

Posted: Tue Sep 07, 2004 1:22 pm
by ebs
Kale,

If you haven't already come up with something, here is a simple procedure to list each window's title and class:

Code: Select all

Procedure ListWindows(Window, Parameter) 
  WindowClass.s = Space(255)
  WindowTitle.s = Space(255)
  GetClassName_(Window, WindowClass, 255)
  GetWindowText_(Window, WindowTitle, 255)
  If WindowTitle
    Debug WindowTitle + "|" + WindowClass
  EndIf
  
  ProcedureReturn #True  
EndProcedure 

EnumWindows_(@ListWindows(), 0)
The hard part will be to determine which are the visible application windows.

Regards,
Eric

Posted: Tue Sep 07, 2004 7:04 pm
by Kale
The hard part will be to determine which are the visible application windows.
No Prob! All done, you can now download an updated version from the post above. :)

Posted: Tue Sep 07, 2004 7:39 pm
by ebs
Kale,

That was fast! This is turning out to be a really useful utility!

I found a problem with "Add All Windows" - it doesn't clear the Window linked list, so you get multiple copies of each window in the list. I suggest clearing the list in the AddAllWindows() procedure, like this:

Code: Select all

;add all visible windows
Procedure AddAllWindows()
  ClearList(Window())
  EnumWindows_(@FilterWindows(), 0)
EndProcedure
One other suggestion: Clear the windows details in the bottom section when a window is deleted from the list.

Regards,
Eric

Posted: Tue Sep 07, 2004 8:14 pm
by Kale
I found a problem with "Add All Windows" - it doesn't clear the Window linked list, so you get multiple copies of each window in the list.
Done. :)
One other suggestion: Clear the windows details in the bottom section when a window is deleted from the list.
Done. :twisted:
I also found a little prob with capturing a minimised window so i just grab the window coords for when it is restored instead of the obscure minimised ones. :wink:

Posted: Tue Sep 07, 2004 11:10 pm
by ebs
Kale,
I also found a little prob with capturing a minimised window so i just grab the window coords for when it is restored instead of the obscure minimised ones.
Would that explain getting coordinates like -32000,-32000? I noticed that while I was experimenting.

If you can stand it, I have another suggestion: a command-line parameter, maybe something like "-record". It would take the snapshot of all open windows, save the file and exit without showing the GUI, similiar to the "-tidy" parameter. That way, the snapshot/tidying could be done just using the command line or shortcuts (no GUI), if desired.

If you want to see the code I came up with, let me know. If you'd prefer to do it yourself, I won't be (too) hurt... :cry:

Regards,
Eric

Posted: Wed Sep 08, 2004 12:48 am
by Kale
Would that explain getting coordinates like -32000,-32000? I noticed that while I was experimenting.
Yeah thems the ones! :? fixed now :)
If you can stand it, I have another suggestion: a command-line parameter, maybe something like "-record". It would take the snapshot of all open windows, save the file and exit without showing the GUI, similiar to the "-tidy" parameter. That way, the snapshot/tidying could be done just using the command line or shortcuts (no GUI), if desired.
Done. :) Grab the new one above!
If you want to see the code I came up with, let me know.
Sure! :D
If you'd prefer to do it yourself, I won't be (too) hurt... :cry:

he he, feel free to modify it in anyway m8, i always feel like im obliged to make changes especially if its handy functionality which really should of been in there in the first place but i was too lazy. :oops: :lol:

Posted: Sat Sep 11, 2004 3:31 pm
by MrMat
This is great! Thanks for sharing :D How about making it optionally minimise unlisted windows?

Posted: Sat Sep 11, 2004 4:45 pm
by Kale
I just noticed i left some debug stuff in that last file :oops: I've now updated the link above :)
How about making it optionally minimise unlisted windows?
How do u mean?

Posted: Sat Sep 11, 2004 5:20 pm
by MrMat
Hi Kale,
Kale wrote:How do u mean?
I mean when you click on the "Resize and move" button it will currently resize and move all the windows you've told it to and leave any other windows you happen to have open in their current position. It'd be neat if it would also minimise the other open windows on your desktop, so that the windows visible are just the ones you originally listed. Does that make sense? :?

It's just an idea, not sure if anyone else would find it useful or just me! ;-)

Cheers,
Mat

Posted: Mon Sep 13, 2004 5:08 pm
by ebs
@Kale,

I thought Mat's idea about minimizing other windows was a good one, so I added that feature to your code. I'd be happy to provide you and/or Mat with a copy of my revised code, but there's a problem. I have made changes to your user interface (removed the Close button and added a checkbox), as well as adding and revising the code.

Since this very handy program is your work, I don't want to go handing out my changed version, unless you say it's OK. If you would like a copy of my changes, just let me know. If you say it's OK for me to send a copy to Mat, I'll do that too. If you'd prefer me to keep my hands off of your code in the future, that's fine - just say so. :wink:

@MrMat,

If you'd like a copy of my code, AND if Kale says it's OK, send me a private message with your e-mail address.

Regards,
Eric