Jump to content

[SOLVED] Winmove() & Wingetpos()


Recommended Posts

Here is my code

Global $IniFile = @ScriptDir & "\settings.ini"
Global $Brow1 = "MSN.com - Mozilla Firefox"
global $wsize = iniread($inifile, "window", "size", "")

WinWait($Brow1)

if $wsize = "" then
$size = WinGetPos($Brow1)
IniWrite($IniFile, "Window", "pos", $size[0] & "," & $size[1])
iniwrite($inifile, "window", "size", $size[2] & "," & $size[3])
msgbox(0, "ESB 1.5", "Your window position has been saved", 20)
endif

$size1 = iniread($inifile, "window", "pos", "")
$pos = stringsplit($size1, ",")
$size2 = iniread($inifile, "window", "size", "")
$size = stringsplit($size2, ",")

sleep(5000)
WinMove($Brow1, "", $pos[0], $pos[1], $size[1], $size[2])

The problem is.... the window is moved into a position, and I run the code. It either doesn't save it correctly, or it doesn't recall the cords correctly.

as an example, the window would be in upper right corner, but will resize in the lower left corner.

Anyone have any ideas?

Thanks

Cue

edit:Marked as solved.

Edited by cueclub
Link to comment
Share on other sites

right now the only thing in the settings file are the window position and size.

But here is what is written

[Window]
pos=644,154
size=726,587

So I know it is writing something. But the window ends up in a different position each time i try to do it.

edit( added more info)

Edited by cueclub
Link to comment
Share on other sites

I just tested it...and it works fine for me, unless I don't understand your problem correctely.....I tested with window maximized, it told me 'Your window position has been saved' so I minimized the window, ran again, and it maximized my window. Maybe I don't understand the problem?

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

I was trying to hav it save the position and size..

If i save it in 1 area, and then move the window to another area, I wanted it to move it back to the saved area. For some reason it was not working on my system.

Link to comment
Share on other sites

Maybe I misunderstood you question, are you wanting it to keep watching the window, and once moved to immediately place it back, or only when you click on the app? I had to click the app to move the window back. Also where you on MSN while testing, your $brow1 is title for that page.

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...