Jump to content
Sign in to follow this  
cueclub

[SOLVED] Winmove() & Wingetpos()

Recommended Posts

cueclub

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

Share this post


Link to post
Share on other sites
cueclub

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

Share this post


Link to post
Share on other sites
Realm

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.  

Share this post


Link to post
Share on other sites
cueclub

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.

Share this post


Link to post
Share on other sites
Realm

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.  

Share this post


Link to post
Share on other sites
1905russell

Anyone have any ideas?

Try - WinMove($Brow1, "", $pos[1], $pos[2], $size[1], $size[2])

Share this post


Link to post
Share on other sites
Realm

Good Eye 1905russell


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.  

Share this post


Link to post
Share on other sites
cueclub

Try - WinMove($Brow1, "", $pos[1], $pos[2], $size[1], $size[2])

Ah I had forgotten about the [0] ,[1], [2] issues. I feel so dumb now. Thanks for the help

Cue

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.