JohnOne Posted November 29, 2012 Posted November 29, 2012 Then perhaps GUIRegisterMsg could help you, I think it registers messages for controls too. Not 100% on that though. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kaotkbliss Posted November 29, 2012 Posted November 29, 2012 FireFox mentioned wanting to make a UDF out of this. It almost sounds like he wants to create a new "GuiCreate" that will automatically select the correct size of the gui based on where the controls are. Such as if later you add new controls to the script, the gui would auto-resize to fit them all without adjusting the code. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
JohnOne Posted November 29, 2012 Posted November 29, 2012 Pretty cool idea if that's correct, and the answer would be some pretty difficult and complicated mathematical calculations. Still just guessing though. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kaotkbliss Posted November 29, 2012 Posted November 29, 2012 The easiest way I could think of to accomplish this would be to create an array of all the controls, then run through the array and grab the lowest X value, lowest Y value, highest X+control width value, and highest Y+control height value. But I believe it's already been mentioned as being not fast enough. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
JohnOne Posted November 29, 2012 Posted November 29, 2012 Well I was still getting it wrong. After your suggestion of what the OP might be trying to do, I though it was taking as parameters "buttons|2,edit|1,input|1,label|4" or something similar, and the calculations would be to arrange 2 buttons 1 edit, 1 input and 4 labels neatly into a gui and create it. Like when you don't really care how they are arranged so long as they're all there type of thing. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
FireFox Posted November 29, 2012 Author Posted November 29, 2012 @kaotkbliss Thanks for pointing out what I said before. I'm not making an UDF for what you said, you will know when I will post it. If it was only for my script, of course I would know the ctrl positions and this topic would not have any sense. Anyway, thanks for your help.
UEZ Posted November 29, 2012 Posted November 29, 2012 (edited) Might be useful: Func ControlsGetMinMaxPos($hWnd) Local $iPosX_Min = 0xFFFF, $iPosX_Max, $iPosY_Min = 0xFFFF, $iPosY_Max Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD) Do $aRect = ControlGetPos($hChild, "", 0) If $aRect[0] < $iPosX_Min Then $iPosX_Min = $aRect[0] If $aRect[1] < $iPosY_Min Then $iPosY_Min = $aRect[1] If $aRect[0] + $aRect[2] > $iPosX_Max Then $iPosX_Max = $aRect[0] + $aRect[2] If $aRect[1] + $aRect[3] > $iPosY_Max Then $iPosY_Max = $aRect[1] + $aRect[3] $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) Until Not $hChild Local $aMinMax[4] = [$iPosX_Min, $iPosY_Min, $iPosX_Max, $iPosY_Max] Return $aMinMax EndFunc Br, UEZ Edited November 29, 2012 by UEZ FireFox 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
FireFox Posted November 29, 2012 Author Posted November 29, 2012 @UEZ Thank you. I will test the speed between the two functions given. Br, FireFox.
jdelaney Posted November 29, 2012 Posted November 29, 2012 nice, that's a much cleaner way to get the controls IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
guinness Posted November 29, 2012 Posted November 29, 2012 Very nice UEZ. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
FireFox Posted November 30, 2012 Author Posted November 30, 2012 I will definitely use the function of UEZ. Here is my version of jdelaney's function : Func _WindowGetBoundCtrls($hWnd) Local $aWndClassList = StringSplit(WinGetClassList($hWnd), @CRLF) Local $sPriorClass, $iCounter = 1, $aBoundCtrls[2] = [0, 0], $aCtrlPos If Not $aWndClassList[0] Then Return $aBoundCtrls $sPriorClass = $aWndClassList[1] For $iList = 1 To $aWndClassList[0] - 1 If $aWndClassList[$iList] <> $sPriorClass Then $iCounter = 1 $sPriorClass = $aWndClassList[$iList] EndIf $aCtrlPos = ControlGetPos($hWnd, "", "[CLASSNN:" & $aWndClassList[$iList] & $iCounter & "]") If $aCtrlPos[0] + $aCtrlPos[2] > $aBoundCtrls[0] Then $aBoundCtrls[0] = $aCtrlPos[0] + $aCtrlPos[2] If $aCtrlPos[1] + $aCtrlPos[3] > $aBoundCtrls[1] Then $aBoundCtrls[1] = $aCtrlPos[1] + $aCtrlPos[3] $iCounter += 1 Next Return $aBoundCtrls EndFunc ;==>_WindowGetBoundCtrls
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now