Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Save Window x y Location


  • Please log in to reply
5 replies to this topic

#1 anixon

anixon

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 708 posts

Posted 16 April 2011 - 10:01 PM

Using the code the value written to the INI file for both x and y is minus eight '-8' which is not the true location of the AutoIT created window. This is required so when the user opens the Window on the next occasion it is opened in its last known position
I have not posted the code which reads the INI file for no other reason as it is probably not necessary to resolve why the wrong value is being written to the INI file in the first place. Both $sUpLeft and $sUpTop are set as Global Variables.



;//Compile Current Window Position Func _RFCalcWinPos()  ;//Set the Focus on the RFCalculator Window  WinActivate($Title, "")  ;//Capture the RFCalculator Window x y position  Local $Handle = WinGetHandle($Title, "")  $RFScreenPos = WinGetPos($Handle, "")  If UBound($RFScreenPos) = 4 Then   $sUpLeft = $RFScreenPos[0]   $sUpTop = $RFScreenPos[1]   ;//Width and Height are Constants   ;$sUPWidth = $RFScreenPos[2]   ;$sUpHeight = $RFScreenPos[3]  EndIf  msgbox(0,"",$sUpLeft) ;//### Debug  IniWrite($MyFile, "sUpLeft", "value", $sUpLeft) IniWrite($MyFile, "sUpTop", "value", $sUpTop) EndFunc   ;==>_RFCalcWinPos




Help is always appreciated Ant.. :unsure:







#2 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,216 posts

Posted 16 April 2011 - 11:00 PM

You adapted this code from another language?
http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!       


#3 CaptainClucks

CaptainClucks

    Unum Cavillator Spuria

  • Active Members
  • PipPipPipPipPipPip
  • 1,224 posts

Posted 16 April 2011 - 11:46 PM

Using the code the value written to the INI file for both x and y is minus eight '-8' which is not the true location of the AutoIT created window. This is required so when the user opens the Window on the next occasion it is opened in its last known position
I have not posted the code which reads the INI file for no other reason as it is probably not necessary to resolve why the wrong value is being written to the INI file in the first place. Both $sUpLeft and $sUpTop are set as Global Variables.



;//Compile Current Window Position Func _RFCalcWinPos()  ;//Set the Focus on the RFCalculator Window  WinActivate($Title, "")  ;//Capture the RFCalculator Window x y position  Local $Handle = WinGetHandle($Title, "")  $RFScreenPos = WinGetPos($Handle, "")  If UBound($RFScreenPos) = 4 Then   $sUpLeft = $RFScreenPos[0]   $sUpTop = $RFScreenPos[1]   ;//Width and Height are Constants   ;$sUPWidth = $RFScreenPos[2]   ;$sUpHeight = $RFScreenPos[3]  EndIf  msgbox(0,"",$sUpLeft) ;//### Debug  IniWrite($MyFile, "sUpLeft", "value", $sUpLeft) IniWrite($MyFile, "sUpTop", "value", $sUpTop) EndFunc   ;==>_RFCalcWinPos




Help is always appreciated Ant.. :unsure:

I'm having a problem understanding... your problem... I'm smoking weed right now and the way some of you decide to compose yall's post's is kinda hard to apprehend...

(Or its probably just me.. Posted Image, Not trying to be an ass though..)

But by what I understood, you're trying to save the windows position and open it in the position it was last used right?

Is this what you're trying to do or what?


AutoIt         
#include<ButtonConstants.au3> #include<GUIConstantsEx.au3> #include<WindowsConstants.au3> $MyFile = @DesktopDir&"\~$ettings.ini" If FileExists($MyFile) Then     $GUI=GUICreate('TEST',173, 126,IniRead($MyFile,"sUpLeft","value",0),IniRead($MyFile,"sUpTop","value",0)) Else     $GUI=GUICreate('TEST') EndIf $Button1 = GUICtrlCreateButton("Set Pos", 56, 80, 65, 25, $WS_GROUP) #region - GUI Create GUISetState() #endregion #region - GUI SelectLoop While 1     $msg = GUIGetMsg()     Select         Case $msg = $GUI_EVENT_CLOSE             Exit         Case $msg = $Button1             _RFCalcWinPos()     EndSelect WEnd #endregion ;//Compile Current Window Position Func _RFCalcWinPos()  ;//Set the Focus on the RFCalculator Window  WinActivate($GUI, "")  ;//Capture the RFCalculator Window x y position  Local $Handle = WinGetHandle($GUI, "")  $RFScreenPos = WinGetPos($Handle, "")  If UBound($RFScreenPos) = 4 Then   ;//Width and Height are Constants   ;$sUPWidth = $RFScreenPos[2]   ;$sUpHeight = $RFScreenPos[3]  EndIf ; msgbox(0,"",$RFScreenPos[0]) ;//### Debug  IniWrite($MyFile, "sUpLeft", "value", $RFScreenPos[0]) IniWrite($MyFile, "sUpTop", "value", $RFScreenPos[1]) EndFunc   ;==>_RFCalcWinPos

Edited by System238, 16 April 2011 - 11:52 PM.

Spoiler
Warning: Posts by this user are subject to change or may disappear without notice.

#4 anixon

anixon

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 708 posts

Posted 17 April 2011 - 06:39 AM

You adapted this code from another language?



I am pretty sure that it was adapted from a published AutoIT Script. Ant..

#5 anixon

anixon

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 708 posts

Posted 17 April 2011 - 06:53 AM

I'm having a problem understanding... your problem... I'm smoking weed right now and the way some of you decide to compose yall's post's is kinda hard to apprehend...

(Or its probably just me.. Posted Image, Not trying to be an ass though..)

But by what I understood, you're trying to save the windows position and open it in the position it was last used right?

Is this what you're trying to do or what?


AutoIt         
#include<ButtonConstants.au3> #include<GUIConstantsEx.au3> #include<WindowsConstants.au3> $MyFile = @DesktopDir&"\~$ettings.ini" If FileExists($MyFile) Then     $GUI=GUICreate('TEST',173, 126,IniRead($MyFile,"sUpLeft","value",0),IniRead($MyFile,"sUpTop","value",0)) Else     $GUI=GUICreate('TEST') EndIf $Button1 = GUICtrlCreateButton("Set Pos", 56, 80, 65, 25, $WS_GROUP) #region - GUI Create GUISetState() #endregion #region - GUI SelectLoop While 1     $msg = GUIGetMsg()     Select         Case $msg = $GUI_EVENT_CLOSE             Exit         Case $msg = $Button1             _RFCalcWinPos()     EndSelect WEnd #endregion ;//Compile Current Window Position Func _RFCalcWinPos()  ;//Set the Focus on the RFCalculator Window  WinActivate($GUI, "")  ;//Capture the RFCalculator Window x y position  Local $Handle = WinGetHandle($GUI, "")  $RFScreenPos = WinGetPos($Handle, "")  If UBound($RFScreenPos) = 4 Then   ;//Width and Height are Constants   ;$sUPWidth = $RFScreenPos[2]   ;$sUpHeight = $RFScreenPos[3]  EndIf ; msgbox(0,"",$RFScreenPos[0]) ;//### Debug  IniWrite($MyFile, "sUpLeft", "value", $RFScreenPos[0]) IniWrite($MyFile, "sUpTop", "value", $RFScreenPos[1]) EndFunc   ;==>_RFCalcWinPos

I have to go and pull some weeds I pretty sure it is called Dock so unfortunately today I have pretty much run out of time but within the next 24 hours I will test your version of capturing screen position and post a response. Ant..

#6 anixon

anixon

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 708 posts

Posted 29 April 2011 - 08:56 PM

I have to go and pull some weeds I pretty sure it is called Dock so unfortunately today I have pretty much run out of time but within the next 24 hours I will test your version of capturing screen position and post a response. Ant..



I apologise for not responding earlier but with Easter and other family commitments I have been dragged in other directions. Well the short and quick answer is the code works perfectly and I thank the respondant/s


Thanks again for the help Ant.. :unsure:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users