Save Window Position and Window Size

There are two included subcompositions. One saves the window position, while the other saves the window position and window size. My original composition for capturing window position and size didn’t correctly check if the file existed first, but this revised composition does.

Run the composition and change the window position or size. When the composition is started again, the window will open at the same position, with the same dimensions.

position-save-corrected.zip (8.68 KB)

3 Likes

Thank you Jean Marie, helpful !

However, without the time to dive in to the sub comps, is it possible there is something with the “size + position” subcomp, where if used after a “position only” sub com it works, but if used first without the “position only” subcomp beforehand (connecting a cable to a “position only” subcomp, launch, re-connect the cable to the “position + size” subcomp, relaunch), it sets a window size of 0x0, aka you get no window ?

Capture d’écran 2020-09-27 à 13.45.21.png
Capture d’écran 2020-09-27 à 13.49.42.jpg

Also, from a non-coder perspective I don’t know if there is a better way to achieve this but, are these subcompositions the end version of how Vuo will remember window size and position for exported apps ? (I guess for Vuo compositions The composition view should have the previous size and pos after pressing Stop->Run in the Editor will be used, but as @micpool wrote there, will that option also work for exported apps ?)  

it sets a window size of 0x0, aka you get no window ?

I see the problem. I’ll work on a solution. I’ll have to ask the team what the plan is for The composition view should have the previous size and pos ….

1 Like

Thanks, Bodysoulspirit.

It took me a bit, but my revised composition for window position and size checks if the file exists first, so it will work initially and each time thereafter. (If you’ve run the composition previously with the old subcomposition, and there is data in .json file, then that’s what will be retrieved.)

1 Like