EmptySpace Posted May 13, 2012 Share Posted May 13, 2012 Im wondering if its possible to do like that. For example there is GUI like this #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 341, 102, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 8, 8, 121, 21) $Input2 = GUICtrlCreateInput("Input2", 8, 32, 121, 21) $Edit1 = GUICtrlCreateEdit("", 152, 8, 185, 89) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Button1", 8, 64, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd What I want is that when I put any text in imput boxes and click button that text appears in edit box and saves( for this need to save text in ini file?) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 13, 2012 Moderators Share Posted May 13, 2012 Edgaras, So what have you tried so far that has not worked? 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...
EmptySpace Posted May 13, 2012 Author Share Posted May 13, 2012 "tried" I tried nothing. After this post I spent ~2hrs reading and found alot examples now Im trying to build script which I want. But I still dont know if its possible to make what I really want. Hmmm its like in compiled gui make buttons without rewriting code. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 13, 2012 Moderators Share Posted May 13, 2012 Edgaras, But I still dont know if its possible to make what I really wantWhat you have said you want is extremely simple, so I suggest you spend the next few hours reading about these functions in the Help file: GUICtrlRead - Get text from a control GUICtrlSetData - Put text in a control FileWrite - Save data to a file Come back if you run into diffculty putting it all together. 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...
EmptySpace Posted May 13, 2012 Author Share Posted May 13, 2012 hmm "FileWrite" something new for my brain to eat Thanks. Link to comment Share on other sites More sharing options...
EmptySpace Posted May 13, 2012 Author Share Posted May 13, 2012 Ok "filewrite" is really good thing Its what I've been searching for all time. With that I can create my basic script. When au3 isnt compiled into exe filewrite can write here but it wont do that if code is compiled? So i will need to write in ini and then use iniread functions or smth? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 13, 2012 Moderators Share Posted May 13, 2012 Edgaras, Why do you want to write the text into an ini file? An ini file is a very specific format with separate sections, keys and values. What exactly are you trying to do with the data you save? Please help us to help you by explaining clearly what you want to do - adding information a bit at time just annoys those who are willing to help you. 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...
EmptySpace Posted May 13, 2012 Author Share Posted May 13, 2012 Its hard to explain when my english is poor + I dont know exactly what I want to make as i want to do so much Ok, imagine that there is gui. In gui is imput box and button. In other gui corner is list of buttons/treeview or smth. When you write in input box and hit button it saves text which u wrote and adds in "buttons/treeview" and in code it makes variables for example $imput1 = "textuwrote" and $imput2 = "textuwrote2" and so on. So when clicking on "buttons/treeview" code which I laready done will work but it will depend on what text is wrote in input and puted in variables. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 13, 2012 Moderators Share Posted May 13, 2012 Edgaras, Have a play with this and see if it is close to what you want: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUITreeview.au3> #include <Array.au3> ; Global variables Global $sIni = "Eds.ini" ; ini file Global $aTVI_Handle[1] = [0] ; list of treeviewitem handles Global $fDblClk = False ; TreeView click flag $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("Key", 10, 10, 200, 20) $cInput_1 = GUICtrlCreateInput("", 10, 40, 200, 20) GUICtrlCreateLabel("Value", 10, 70, 200, 20) $cInput_2 = GUICtrlCreateInput("", 10, 90, 200, 20) $cButton = GUICtrlCreateButton("Save", 10, 150, 80, 30) $cTreeView = GUICtrlCreateTreeView(250, 10, 230, 400, BitOR($GUI_SS_DEFAULT_TREEVIEW, $WS_BORDER)) $cParent = GUICtrlCreateTreeViewItem(" List", $cTreeView) GUISetState() ; Initialise "DoubleClick on TreeView" function GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; If button clicked add to TreeView Case $cButton ; Check we have something to add If GUICtrlRead($cInput_1) And GUICtrlRead($cInput_2) Then _Add() EndIf EndSwitch ; If tree view double clicked If $fDblClk = True Then ; Which item? $hItem = _GUICtrlTreeView_GetSelection($cTreeView) ; Find handle $iSection = _ArraySearch($aTVI_Handle, $hItem) If Not @error Then ; if valid then read ini file secion $aSection = IniReadSection($sIni, $iSection) ; Show content ConsoleWrite($aSection[1][0] & " - " & $aSection[1][1] & @CRLF) EndIf ; Clear flag $fDblClk = False EndIf WEnd Func _Add() ; Read the content of the inputs $sKey = GUICtrlRead($cInput_1) $sValue = GUICtrlRead($cInput_2) ; Increase the count $aTVI_Handle[0] += 1 ; Resize the array ReDim $aTVI_Handle[$aTVI_Handle[0] + 1] ; Create the item and store the handle $aTVI_Handle[$aTVI_Handle[0]] = GUICtrlGetHandle(GUICtrlCreateTreeViewItem($sKey, $cParent)) ; Show the item _GUICtrlTreeView_Expand($cTreeView) ; Write the key/value pair to the ini file IniWrite($sIni, $aTVI_Handle[0], $sKey, $sValue) ; Clear the inputs GUICtrlSetData($cInput_1, "") GUICtrlSetData($cInput_2, "") EndFunc ;==>_Add Func _WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tagNMHDR Switch $wParam ; if it is our treeview Case $cTreeView $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return ; if it was double clicked - set the flag If DllStructGetData($tagNMHDR, 3) = $NM_DBLCLK Then $fDblClk = True EndSwitch $tagNMHDR = 0 EndFunc ;==>_WM_NOTIFY Add something to both inputs and press the button. The key appears in the treeview and the key/value pair are stored in the ini file. if you double-click on an item in the treeview, the key/value pair are written to the SciTe console. Let me know how near I got - it will be easy to refine it. 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...
EmptySpace Posted May 14, 2012 Author Share Posted May 14, 2012 (edited) We are going in that way. It does what I want but also need to save data and open it when I start code again (its not problem i think just need to make iniread or smth?) . Its quite complicated for me. Actually it does everything what I want. Now I need these treeview buttons to work or make that writen text would appear in main script as variables like $var = textIwrote. So already written code will work but it will depend on what text is wrote in variables. "the key/value pair are written to the SciTe console." so "writen text would appear in main script"? Edited May 14, 2012 by Edgaras Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 14, 2012 Moderators Share Posted May 14, 2012 Edgaras,Loading any existing key/value pairs from the ini is easy: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUITreeview.au3> #include <Array.au3> ; Global variables Global $sIni = "Eds.ini" ; ini file Global $aTVI_Handle[1] = [0] ; list of treeviewitem handles Global $fDblClk = False ; TreeView click flag $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("Key", 10, 10, 200, 20) $cInput_1 = GUICtrlCreateInput("", 10, 40, 200, 20) GUICtrlCreateLabel("Value", 10, 70, 200, 20) $cInput_2 = GUICtrlCreateInput("", 10, 90, 200, 20) $cButton = GUICtrlCreateButton("Save", 10, 150, 80, 30) $cTreeView = GUICtrlCreateTreeView(250, 10, 230, 400, BitOR($GUI_SS_DEFAULT_TREEVIEW, $WS_BORDER)) $cParent = GUICtrlCreateTreeViewItem(" List", $cTreeView) ; See if ini file already has entries $aIniSections = IniReadSectionNames($sIni) If Not @error Then ; Add item for each section For $i = 1 To $aIniSections[0] ; Increase the count $aTVI_Handle[0] += 1 ; Resize the array ReDim $aTVI_Handle[$aTVI_Handle[0] + 1] ; Get the Key value $aPair = IniReadSection($sIni, $aIniSections[$i]) ; Create the item and store the handle $aTVI_Handle[$aTVI_Handle[0]] = GUICtrlGetHandle(GUICtrlCreateTreeViewItem($aPair[1][0], $cParent)) ; Show the item _GUICtrlTreeView_Expand($cTreeView) Next EndIf GUISetState() ; Initialise "DoubleClick on TreeView" function GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; If button clicked add to TreeView Case $cButton ; Check we have something to add If GUICtrlRead($cInput_1) And GUICtrlRead($cInput_2) Then _Add() EndIf EndSwitch ; If tree view double clicked If $fDblClk = True Then ; Which item? $hItem = _GUICtrlTreeView_GetSelection($cTreeView) ; Find handle $iSection = _ArraySearch($aTVI_Handle, $hItem) If Not @error Then ; if valid then read ini file secion $aSection = IniReadSection($sIni, $iSection) ; Show content ConsoleWrite($aSection[1][0] & " - " & $aSection[1][1] & @CRLF) EndIf ; Clear flag $fDblClk = False EndIf WEnd Func _Add() ; Read the content of the inputs $sKey = GUICtrlRead($cInput_1) $sValue = GUICtrlRead($cInput_2) ; Increase the count $aTVI_Handle[0] += 1 ; Resize the array ReDim $aTVI_Handle[$aTVI_Handle[0] + 1] ; Create the item and store the handle $aTVI_Handle[$aTVI_Handle[0]] = GUICtrlGetHandle(GUICtrlCreateTreeViewItem($sKey, $cParent)) ; Show the item _GUICtrlTreeView_Expand($cTreeView) ; Write the key/value pair to the ini file IniWrite($sIni, $aTVI_Handle[0], $sKey, $sValue) ; Clear the inputs GUICtrlSetData($cInput_1, "") GUICtrlSetData($cInput_2, "") EndFunc ;==>_Add Func _WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tagNMHDR Switch $wParam ; if it is our treeview Case $cTreeView $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return ; if it was double clicked - set the flag If DllStructGetData($tagNMHDR, 3) = $NM_DBLCLK Then $fDblClk = True EndSwitch $tagNMHDR = 0 EndFunc ;==>_WM_NOTIFYI used this as an ini file:[1] $Var1="fred" [2] $Var2=9999 [3] $Var3="a" & "b"But I am still unsure what you are trying to do. You said "So when clicking on "buttons/treeview" code which I laready done will work" - so why are you now asking if the "writen text would appear in main script"? The code extracts the key/value pair from the ini - what more does your "already done" code require? 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...
EmptySpace Posted May 14, 2012 Author Share Posted May 14, 2012 (edited) Hmm I just cant find out what example i should use which would be easy to understand."writen text would appear in main script" i wrote nonsense here. Oh, just got idea. So there is 2imput boxes, button to save what is wrote in input box and treeview. Now for example you write$Var2=0x999999 and it saves in treeview(no matter where). +in the gui is one more button. Checking treeview(now im sure that i need to change treeview to other thing. Maybe its possible to make that check boxes?) and pushing that new button lets call it "go".Under that button is code for example PixelSearch( 0, 0, @DeskopWidth, @DeskopHeight, $var2) (right example?)Clicking that button PixelSearch will use $var2 text. Edited May 14, 2012 by Edgaras 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