abdulrahmanok Posted February 1, 2017 Share Posted February 1, 2017 (edited) Hello Brothers , This Is an Example Script which Created by Koda : #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 712, 488, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 368, 248, 105, 41) $Button2 = GUICtrlCreateButton("Button2", 224, 248, 105, 49) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I Always think how i can change the GUI size without any form designer but i didn't figure how to do this for example I want to make GUI bigger so i must edit this : $Form1 = GUICreate("Form1", 712, 488, 192, 124) to be like this : $Form1 = GUICreate("Form1", 800, 600, 192, 124) but it's completly diffrent of what i wanted so Is i need to try decrease 800, 600 until did it ! very difficault . another problem that don't know how to move button to another location : $Button2 = GUICtrlCreateButton("Button2", 224, 248, 105, 49) I know this is the current location is : (224, 248, 105, 49) but i dont know how to write my own location without using GUI Createor Hope Any one can help me with this and I will be waiting for any request to make it more clearer Edited February 2, 2017 by abdulrahmanok Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2017 Moderators Share Posted February 1, 2017 abdulrahmanok, Open the Help file and look at the pages for GUICreate and GUICtrlCreateButton. There you will see what the parameters are: GUICreate ( "title" , width , height , left , top) ; Left and top are relative to the top left of the screen GUICtrlCreateButton ( "text", left, top , width , height) ; Left and top are relative to the top left of the GUI holding the control So you adjust the relevant parameters to get the GUI and button to the required size and location. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 1, 2017 Author Share Posted February 1, 2017 50 minutes ago, Melba23 said: abdulrahmanok, Open the Help file and look at the pages for GUICreate and GUICtrlCreateButton. There you will see what the parameters are: GUICreate ( "title" , width , height , left , top) ; Left and top are relative to the top left of the screen GUICtrlCreateButton ( "text", left, top , width , height) ; Left and top are relative to the top left of the GUI holding the control So you adjust the relevant parameters to get the GUI and button to the required size and location. M23 Thanks for fast reply,I'm already know parameters what i want to know is that i need "Window Tool" To detect Coords for size and place to move? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2017 Moderators Share Posted February 1, 2017 abdulrahmanok, That is not at all clear - but let me try to help. If you use the Window Info tool to determine location and size then you need to adjust the <Option - Coord mode> settings and use the "Mouse" tab to read the coordinates you choose (you can use the "< >" arrows to see it). To locate the position of a GUI, you need to select "Screen" so that the coordinates that are shown are relative to the screen - when dealing with a control, you need to select "Window" so that the coordinates are relative the window which contains it. Any use? If not then please explain exactly what it is you are trying to do with your GUI and button. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 1, 2017 Author Share Posted February 1, 2017 27 minutes ago, Melba23 said: abdulrahmanok, That is not at all clear - but let me try to help. If you use the Window Info tool to determine location and size then you need to adjust the <Option - Coord mode> settings and use the "Mouse" tab to read the coordinates you choose (you can use the "< >" arrows to see it). To locate the position of a GUI, you need to select "Screen" so that the coordinates that are shown are relative to the screen - when dealing with a control, you need to select "Window" so that the coordinates are relative the window which contains it. Any use? If not then please explain exactly what it is you are trying to do with your GUI and button. M23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2017 Moderators Share Posted February 1, 2017 abdulrahmanok, I guessed correctly - and I explained that in my previous post. You need to set the Window Info tool "Coord mode" to "Window" so that the coordinates are relative to the GUI and not the screen. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 1, 2017 Author Share Posted February 1, 2017 @Melba23 Thank You Very much I Figured it now and tomorrow I will build my own GUI without any GUI Creator #Solved Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2017 Moderators Share Posted February 1, 2017 abdulrahmanok, As always, delighted I could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 2, 2017 Author Share Posted February 2, 2017 Just One more Issue : Please Follow Pic : 1- 2- Link to comment Share on other sites More sharing options...
Subz Posted February 2, 2017 Share Posted February 2, 2017 Can you post the script? Link to comment Share on other sites More sharing options...
jdelaney Posted February 2, 2017 Share Posted February 2, 2017 (edited) The height of your GUI is 200, and you moved your button to 207...it's outside of the bounds...change it to: $idNotepad = GuiCtrlCreateButton ("Run Notepad",5,170,85,25) Edited February 2, 2017 by jdelaney Subz 1 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. Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 2, 2017 Author Share Posted February 2, 2017 12 hours ago, jdelaney said: The height of your GUI is 200, and you moved your button to 207...it's outside of the bounds...change it to: $idNotepad = GuiCtrlCreateButton ("Run Notepad",5,170,85,25) Ty that's Actually Did What I want but I just want to know how you got Correct corods ? because I coudn't find it with Window Info Tool.@Subz This is the Code: #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idNotepad = GUICtrlCreateButton("Run Notepad", 5,170, 85, 25) Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $iPID = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idNotepad ; Run Notepad with the window maximized. $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) ; Close the Notepad process using the PID returned by Run. If $iPID Then ProcessClose($iPID) EndFunc ;==>Example but like I said I want to know how to get these Coords to create another Buttons in Specific Places. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2017 Moderators Share Posted February 2, 2017 abdulrahmanok, it is not the Window Info tool that will give you the answer - it is simple maths. If your GUI is created with a size of 300x200, then your controls must fit with in that area - so any button with a "height" parameter of 25 must have a "top" parameter of at most 175 so be completely visible (200 - 25 = 175). Similarly, if the button has a "width" parameter of 85, it must have a "left" parameter of at most 215 (300 - 85 = 215). Clearer now? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 2, 2017 Author Share Posted February 2, 2017 @Melba23 Ty very much For your efforts but sorry because I'm Totally confused now After set window info tool to Window mood and get X,Y Should i calc it like this : $x=175 , Y= 208 GUI Size - X,Y: 300-175=125 300-200 =100 Then the desired value will be my current position ? Local $idNotepad = GUICtrlCreateButton("Run Notepad", 125, 100, 85, 25) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2017 Moderators Share Posted February 2, 2017 abdulrahmanok, No, you have misunderstood. Using simple estimation allows you to determine the position of controls without using the Window Info tool. In that case you need to determine the position by eye: +---------------------------------+ GUI code (300, 200) | | | | | +----+ | Control code approximately (20, 80, 50, 50) | | | | | +----+ | | | | | +---------------------------------+ The simple calculations that I showed just above make sure the control is visible - the control cannot be placed at more than (250, 150, 50, 50): (300 - 50 = 250 & 200 - 50 = 150) If you do use the Windows Info tool, then you can use the position values directly: +---------------------------------+ GUI code (300, 200) | | | | v | | +----+ | Window Info tool gives marked position at top left as 20, 80 | | | | | +----+ | | | | | +---------------------------------+ So you create the control at (20, 80, 50, 50) Any clearer? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted February 3, 2017 Share Posted February 3, 2017 (edited) Get coords via the script with ControlGetPos...output with _array_display. Edit: a little tired, misread your question. Edited February 3, 2017 by jdelaney 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. Link to comment Share on other sites More sharing options...
abdulrahmanok Posted February 4, 2017 Author Share Posted February 4, 2017 On 2/2/2017 at 11:23 PM, Melba23 said: Any clearer? Thanks for your Patience... +---------------------------------+ GUI code (300, 200) | | | | v | | +----+ | Window Info tool gives marked position at top left as 20, 80 | | | | | +----+ | | | | | +---------------------------------+ I tried hard to understand this but i cant figure how u got (20,80) .... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2017 Moderators Share Posted February 4, 2017 abdulrahmanok, That is the position within the GUI where you wish to create the control and which you found with the cursor of the Window Info tool. Once your GUI is created, move the cursor of the tool to the position where you want to locate the control and read the position given by the tool - then create the control at that position. The 2 methods I suggested in my previous post are essentially identical - in the first you guess a the position (which takes a bit of experience but is quicker), while in the second you use the Window Info tool to get a precise reading of the position. In both cases, once you have the required coordinates you create the control at that position. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
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