topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 3, 2025, 8:19 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Recent Posts

Pages: prev1 ... 131 132 133 134 135 [136] 137 138 139 140 141 ... 1514next
3376
Nice -- looks like this could become a mutlti-faceted tool..

More importantly though: Second night of real-world deployment of WinPosSaver(M)  worked flawlessly.  :up: :up: :up: :up:

ps.
In your menu I see the entry labeled "Sleep"... I assume that puts the COMPUTER to sleep.  It would be nice to have another menu item for just putting the MONITORS to sleep, which is the function that people with my affliction will need for testing.
3377
Screenshot Captor / Re: Settings are reset to default
« Last post by mouser on July 27, 2017, 04:42 PM »
See if the D:\MY_DATA\ works and let's go from there.
The only thing I can think of is if your other directory is somehow not "ready" at startup time...
3378
Finished Programs / Re: FINISHED: Hourly chime software (like Cuckoo for Mac)
« Last post by mouser on July 27, 2017, 11:11 AM »
 :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-*
3379
First real life report: program worked perfectly for me this morning to restore window positions.  Felt like magic.  :Thmbsup:



ps. For those who might be wondering why I've made such a big deal about this problem of moving windows on wake, let me explain:  I have a tiny netbook computer on the bedside table next to my bed.  It stays connected to my desktop in my office with a remote view of the desktop..  As soon as I wake up in the morning, I lean over from bed and tap the keyboard to turn on the netbook monitor and then look to see what new mail and forum activity there is.  The remote view of my desktop only focuses on a small area at a time because the netbook resolution is so small, and it's difficult to move the view around the 4 high-res screens of my desktop -- especially since one of my desktop monitors is in portrait orientation.  So when the window positions scramble, it means I spend the first several seconds of my waking mornings barely conscious and sliding my finger on the mousepad in what seems like an endless futile search for where my mail and browser windows have gone.. And sometimes they are moved under other windows, etc..  Not exactly how I want to spend the first moments of the morning.  So having this problem fixed is so wonderful.
3380
Yep, easy to do.

Since I'm not an ahk person, I will wait for skrommel or someone else to add code to the ahk that can detect a commandline arguement of -load or -save and if found just do that and exit.
That way we can use the same ahk/exe tool both for commandline saving and loading, and also for it's current resident use.
3381
The way i have resolved it is, at 6:58pm, a scheduled task run with nircmd to put the computer into sleep (without this power is cut and WinPosSaver wont know the state of the windows)

Just a note that WinPosSaver doesn't need for the COMPUTER to go to sleep/hibernate (though that may work too), it just needs the MONITOR to go to sleep, which is a separate thing.

Note also that skrommel's code (and my tweaks to it), could very easily be modified to work as commandline function for saving windows and restoring them on command, regardless of monitor status.  So that would be an easy functionality to add if it would be useful.
3382
Skrommel -- If you are looking for features to add, another feature that would be nice to add to this tool is a menu item to put the monitors to sleep -- nircmd has a function for this but i think it's a naturally feature to add to this tool's tray menu if it's easy to add, and it would definitely help others test the tool.
3383
Welcome, Andy.  :up:

Skrommel is the magical creature who deserves the real thanks here.  I am happy to be able to take his work and improve it.
I myself can't wait until I see how this performs tomorrow morning.

And it's nice to see that there is someone else who will benefit from this tool.

By the way -- how did you discover this thread so quickly?



I can already say that it works well enough in my testing that even if the current version isn't perfect, it soon will be -- which is a nice feeling.

Once the program is all cleaned and polished up, I hope we can spread the word to others who have been suffering with this problem.
3384
Just a follow up, official response from AVG (see that thread), has confirmed that it was a false positive mistake.  No actual threat.
3385
I'm uploading a new version which has some options at top of file regarding delays and methods.
I think my new code to quickly cycle until the screen resolution is back to where it was, may not be all that useful because I suspect that the virtual screen size does *not* change when the weird window moving event happens.

So I wrote some new code that basically run the window position restore(load) function TWICE:
First as soon as it gets the signal that a monitor has turned on.
Second, after some delay after a monitor turns on.

The idea being that most of the time the first method works, which makes it so that you don't even notice the fix.
But sometimes this fast restore does not work and windows moves things around after it triggers.  So the second call is a kind of backup restore that will kick in if first one was too quick to take effect.

3386
I have code added now to check virtual screen (desktop) configuration and skip restoring unless it matches, but in initial tests it's not quite clear that this is going to work.. the thing i don't know is if the OS reports a different screen size when this weird OS wakeup moving windows behavior happens.. Stay tuned.

3387
I have code added now to check virtual screen (desktop) configuration and skip restoring unless it matches, but in initial tests it's not quite clear that this is going to work.. the thing i don't know is if the OS reports a different screen size when this weird OS wakeup moving windows behavior happens.. Stay tuned.
3388
One nice refinement to the tool might be if the load process checked if the monitors were back in the same position they were in when settings were saved, and if not, waited another X MS and tried again, up to some max time.
That would eliminate the need to set a long delay waiting for the monitors to come back online and be available, and would let you start trying to restore the layout right away, and it would also avoid trying to restore a layout if the windows would be put offscreen.  Just checking total workspace x,y,w,h for a match with saved settings would be fine -- no need to iterate all the monitors..
3389
New version with substantial bug fix attached.

I was not performing my hex->dec process id check and dupe window avoidance at load time only save time.
This meant some windows would not be "seen" by the script.

The reason for this code is that there were dupe entries in the list of processes/windows which was causing the script to process windows twice.  It happened with some ids being hexadecimal and being dupes with their decimal versions.  I don't understand why but normalizing everything to decimal ids, and then making sure they aren't duplicate id that was just previously written out solves the problem.
3390
Some serious logging there, mouser!

Hey I learned to code in the 1970s -- log statements are my main method of debugging :)

AHK is not a language I am comfortable with so I kept running into confusing issues where things were not behaving as I expected and I had to log info to see what was going on.

As an example, this line in your original code had me flummoxed for quite a while:

Code: Autohotkey [Select]
  1. If monitorStatus=Off
3391
Your manual save and load functions should work well in my version.

Because this version NEVER saves window positions except when you trigger via tray menu or when monitors turn off (testing via nircmd), it should be easy to use the tray menu to save your layout via tray menu, then move around some windows, then load configuration from tray menu.

No need to mess with the automatic restore when monitors power on and off, just experiment with the ability to manually save and load layouts.

Hopefully that will work for you with my version?

3392
And here's a version without any window flickering, by directly restoring the maximized (real) window locations as WELL as the normal restored window locations when it finds a maximized window.
No flickering restore-maximize process needed anymore.

[OLD FILE REMOVED SEE SUBSEQUENT POST]
3393
ps2. Skrommel - I think my new code that checks for maximized window position and does a restore-maximize cycle is needed even if you don't have my OS problem, if you wanted to properly restore a window that was saved maximized on one monitor and is newly maximized on a different monitor.  But it may be possible to avoid the restore-maximize cycle by just directly setting the window position while it's maximized to bring it back to the old monitor?

Another nice feature would be if the app checked to make sure that the restored positions were actually "visible" -- otherwise the app could end up moving things off screen if the old monitors did not all get reconnected, etc.  Not a concern for me just a future idea..
3394
And here is the new code that does just what I suggested -- saves both maximized and normal window positions for each monitor, and then for windows that have mysteriously stayed maximized but moved to a different monitor, those are first restored before they are remaximized.  Other windows are left alone, which makes for much visual ugliness on screen.  (it might be possible to improve this further by making window invisible before unaximizing and remaximizing but that as this is only running on monitor wakeup i think it's no big deal).

I am really excited to try this for real when i wake up tomorrow.

[ps. I have been testing it using nircmd to put monitors to sleep -- my earlier reports that this did not reproduce the problem were wrong; turns out i just needed to give the monitors at least 30 seconds or so to go into power saving mode before waking them up).

I will report tomorrow on real-world test of the tool.  :Thmbsup:

[OLD FILE REMOVED SEE SUBSEQUENT POST]
3395
ps I think the most likely solution to avoiding the unmaximizing-moving-remaximizing fix that is needed for the scrambled windows, is to try to DETECT when a window has been IMPROPERLY MOVED by the OS.. Im thinking now, based on watching how the code works, that this might be possible.  Perhaps by saving in the ini file the MAXIMIZED (not normal) window location and checking that against the current one to see if it has moved physical maximized locations even if it hasn't changed the restored-state location..  But there may be an easier way.
3396
It actually *DOES* seem to work perfectly (other than the ugliness of all the maximized windows jumping around)!!!

This is quite remarkable to me as I 've been suffering through this problem for many months now and had basically given up on it.

I hadn't thought to watch for monitor on/off events.. This part of your approach is wonderful because I can essentially detect only these rare events of monitor on off and the script ONLY needs to take action on those events.  No background processing or periodic saving of window positions is actually needed as far as i can tell (at least for my situation).  So it's essentially not impacting pc performance at all.

Now it's just a matter of tweaking it to see if I can get it to operate in a little less jarring visual display.



Thank you so much skrommel!!!!  :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-*

After I finish mangling and testing the code I will post a new version.


3397
Ok here is latest version, which is working -- tweaked/fixed a few more things in skrommel code (duplicate entries in ini files, a compare of monitorstatus that was not doing a string compare, etc.); very messy and lots of logging, but working.

Skrommel hopefully you have a good file compare tool? (winmerge is free but i love Beyond Compare; if you dont have it let's get you a copy!)

[OLD FILE REMOVED SEE SUBSEQUENT POST]
3398
Ok so following up all everything I wrote, I am having some luck getting the save-load cycle to work even with OS crazy window moving, by explicitly UNMAXIMIZING every maximized window before restoring it.. This creates some god-awfully flying of windows what the state is restored, but it seems to be working.. Now to see if there is a way around explicitly doing that..
3399
I'm experimenting now with ideas..
3400
Skrommel, here is my quickly hacked modification of WinPosSaver.
It does a lot more logging, and it does what i suggested above -- it only saves automatically when monitor turns off, and then restores after a delay once when monitor turns on.

Now, it seems to trigger the save and load correctly, but there is a problem:

I earlier reported that the manual save and load tests worked for me, but I see now that is not quite 100% true.  It seems that some windows are not restoring properly.

The most easily reproducible problem is that when i save a layout with a MAXIMIZED window, and then unmaximize and move the window from one monitor to another, when the layout is loaded, it does NOT move the window back to its saved monitor -- instead it maximizes it on the current monitor.

IN FACT, I believe this is a clue to what is going wrong with the Operating system monitor on/off screwup where windows get moved around.

I think the solution is that if a window is not maximimzed and it is being restored back to a maximized state, it needs to FIRST be moved unmaximized to the old monitor location, and only THEN maximized.. Just an idea..



Another clue and strangeness is that the OS keeps a separate record of the unmaximized position and size of a window, separately from the location of the maximized window, and it can be that when the weird moving of windows occurs during wake, that these locations are actually on DIFFERENT monitors(!).  This is something that is not normally possible when you are moving the windows as a user, but you can see it has happened because when you unmaxmize a window that this has happened to, the un-maximized version of the window jumps to another monitor(!). 

I know this may be confusing to follow..  Bottom line is that the save and restore is somehow not restoring the window state perfectly -- something about the maximized window location is not being restored correctly.


[OLD FILE REMOVED SEE SUBSEQUENT POST]
Pages: prev1 ... 131 132 133 134 135 [136] 137 138 139 140 141 ... 1514next