dickjones007 Posted November 22, 2013 Posted November 22, 2013 is it possible to add buttons into array display for example to add SAVE and CANCEL button
Moderators Melba23 Posted November 22, 2013 Moderators Posted November 22, 2013 dickjones007,You can easily clear the dialog by using the closure [X]. As to saving there is already a copy button which puts all of the array (or the selected rows) into the clipboard - what more do you want? And as I am working on a new version of _ArrayDisplay at this very moment, please do explain exactly what you would like to see - and why. 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
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 it is directly related to my app from this post - '?do=embed' frameborder='0' data-embedContent>> what i had in mind is when array is displayed that instead of COPy SELECTED there are SAVE and CANCEL button SAVE to save the data in a predefined txt file CANCEL of course to return to my app in case of corrections maybe you have something else in mind to do the same thing (custom SAVE dialog or something) ?
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 (edited) i made changes since last post from that link here is the latest code: expandcollapse popup#include <DateTimeConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> #include <Array.au3> #include <File.au3> Global $novidatum Opt("GUIOnEventMode", 1) HotKeySet("+^x", "izlaz1") #region --- CodeWizard generated code Start --- ;SpashImage features: Title=No, Width=900, Height=400, Always On Top SplashImageOn("", "twisterfun.jpg", "900", "400", "-1", "-1", 1) Sleep(300) SplashOff() #endregion --- CodeWizard generated code Start --- Global $folder = @ScriptDir & "\Izdane kartice\" #region ### START Koda GUI section ### #region MENU $Form1_1 = GUICreate("Twisterichne kartice", 624, 450, @DesktopWidth/2-624/2, @DesktopHeight/2-450/2, $WS_BORDER) $MenuItem1 = GUICtrlCreateMenu("&Izbornik") $MenuItem4 = GUICtrlCreateMenuItem("&Novi unos", $MenuItem1) GUICtrlSetOnEvent($MenuItem4, "svenovo1") $MenuItem9 = GUICtrlCreateMenuItem("&Izdane kartice", $MenuItem1) GUICtrlSetOnEvent($MenuItem9, "izdane1") $MenuItem7 = GUICtrlCreateMenu("&O programu") $MenuItem2 = GUICtrlCreateMenuItem("&Autor", $MenuItem7) GUICtrlSetOnEvent($MenuItem2, "oprogramu1") $MenuItem3 = GUICtrlCreateMenuItem("---------------", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("I&zlaz (Ctrl+x)", $MenuItem1) GUICtrlSetOnEvent($MenuItem5, "izlaz1") #endregion MENU $imeprezime = GUICtrlCreateInput("", 100, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Ime i prezime:", 20, 43, 80, 15) $kontakt = GUICtrlCreateCombo("", 320, 40, 80, 21) GUICtrlSetData($kontakt, "Majka|Otac|Djed|Baka|Brat|Sestra|Prijatelj|Ocuh|Pomajka|Stric|Strina|Ujak|Ujna|Bratic|Sestricna", "Majka") GUICtrlCreateLabel("Kontakt osoba:", 240, 43, 80, 15) $kontaktime = GUICtrlCreateInput("", 460, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Ime:", 410, 43, 40, 15) $kontaktel = GUICtrlCreateInput("", 460, 66, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Telefon:", 410, 69, 40, 15) $datumrod = GUICtrlCreateDate("2001/01/01", 100, 66, 120, 20, $DTS_SHORTDATEFORMAT) GUICtrlCreateLabel("Datum rodenja:", 20, 69, 80, 15) $adresa = GUICtrlCreateInput("", 100, 91, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Ulica i kucni broj:", 20, 94, 80, 15) $posta = GUICtrlCreateInput("", 100, 117, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER, $ES_OEMCONVERT)) GUICtrlSetLimit($posta, 5, 5) GUICtrlCreateLabel("Broj pošte:", 20, 120, 80, 15) $grad = GUICtrlCreateInput("", 100, 143, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Grad:", 20, 146, 80, 15) $datum = GUICtrlCreateDate(_NowDate(), 20, 310, 200, 20, $DTS_SHORTDATEFORMAT) $datumizd = GUICtrlCreateLabel("Datum izdavanja kartice", 20, 290, 118, 15) $vrijedido = GUICtrlCreateLabel("Vrijedi do:", 20, 340, 50, 17) $vrsta = GUICtrlCreateCombo("", 20, 210, 200, 25) GUICtrlSetData($vrsta, "Mjesecna|Polugodisnja|Godisnja", "") GUICtrlSetOnEvent($vrsta, "kartica1") $vrijedidoread = GUICtrlCreateInput("", 70, 337, 150, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY)) $vrstakar = GUICtrlCreateLabel("Vrsta kartice", 20, 190, 200, 15) $brojkartlabel = GUICtrlCreateLabel("Broj kartice", 20, 240, 200, 15) $brojkart = GUICtrlCreateInput("", 20, 260, 60, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlSetLimit($brojkart, 3, 3) $djelatna = GUICtrlCreateLabel("Djelatnik:", 20, 17, 60, 15) $djelatnici = GUICtrlCreateCombo("", 100, 13, 119, 25) GUICtrlSetData(-1, "Anita Tihi|Nikolina Matanovic", "Anita Tihi") $Spremi = GUICtrlCreateButton("Spremi", 20, 368, 75, 25) GUICtrlSetOnEvent($Spremi, "spremi1") GUISetState() #endregion ### END Koda GUI section ### ; *** create these here and not over and over in a function $pic = GUICtrlCreatePic("backg.jpg", 240, 14 + 150, 364, 228) While 1 Sleep(10) WEnd Func svenovo1() ;put empty values into fields ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:1]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:3]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:4]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:5]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:6]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:7]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:8]", "") ControlSetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:10]", "") GUICtrlSetImage($pic, "backg.jpg") EndFunc ;==>svenovo1 Func kartica1() Switch GUICtrlRead($vrsta) Case "Mjesecna" GUICtrlSetImage($pic, "mjesecna.jpg") $dodandatum = _DateAdd('M', 1, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) Case "Polugodisnja" GUICtrlSetImage($pic, "polugodisnja.jpg") $dodandatum = _DateAdd('M', 6, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) Case "Godisnja" GUICtrlSetImage($pic, "godisnja.jpg") $dodandatum = _DateAdd('M', 12, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) EndSwitch GUICtrlSetData($vrijedidoread, $novidatum) EndFunc ;==>kartica1 Func spremi1() If FileExists($folder) Then Sleep(100) Else DirCreate($folder) EndIf $imeprezimetxt = GUICtrlRead($imeprezime) $datumrodtxt = GUICtrlRead($datumrod) $kontakttxt = ControlGetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:2]") $kontaktimetxt = GUICtrlRead($kontaktime) $kontakteltxt = GUICtrlRead($kontaktel) $adresatxt = GUICtrlRead($adresa) $postatxt = GUICtrlRead($posta) $gradtxt = GUICtrlRead($grad) $brojkarttxt = GUICtrlRead($brojkart) $datumizdtxt = GUICtrlRead($datum) $djelatnicitxt = GUICtrlRead($djelatnici) $vrstatxt = ControlGetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:8]") $vrijedidotxt = ControlGetText("Twisterichne kartice", "", "[CLASS:Edit; INSTANCE:9]") Local $avArray[10][3] = [["IME I PREZIME",$imeprezimetxt,""],["DATUM ROÐENJA",$datumrodtxt,""],["KONTAKT OSOBA",$kontakttxt,$kontaktimetxt],["KONTAKT TELEFON",$kontakteltxt,""],["ULICA I KUCNI BROJ",$adresatxt,""],[ "GRAD/MJESTO",$postatxt,$gradtxt],["BROJ KARTICE",$brojkarttxt,$vrstatxt],["KARTICA IZDANA",$datumizdtxt,""],["VRIJEDI DO",$vrijedidotxt,""],["DJELATNICA",$djelatnicitxt,""]] _ArrayDisplay($avArray, "Podatci o korisniku kartice") _FileWriteFromArray(@ScriptDir & "\Izdane kartice\" & $vrstatxt & "_" & $brojkarttxt & "_" & $imeprezimetxt & ".txt", $avArray, 0,""," ") ;~ FileWrite(@ScriptDir & "\Izdane kartice\" & $brojkarttxt & "_" & $imeprezimetxt & ".txt", @CRLF & "PREZIME I IME: " & $imeprezimetxt & @CRLF & "DATUM ROÐENJA: " & $datumrodtxt & @CRLF & "KONTAKT OSOBA: " & $kontakttxt & " - " & $kontaktimetxt & @CRLF & "KONTAKT TEL.: " & $kontakteltxt & @CRLF & "ADRESA: " & $adresatxt & @CRLF & "MJESTO: " & $postatxt & " " & $gradtxt & @CRLF & "BROJ KARTICE: " & $brojkarttxt & " - " & $vrstatxt & @CRLF & "KARTICA IZDANA: " & $datumizdtxt & @CRLF & "VRIJEDI DO: " & $vrijedidotxt & @CRLF & @CRLF & "DJELATNICA: " & $djelatnicitxt) MsgBox(4096, "Podatci", "Podatci spremljeni u txt file pod imenom:" & @CRLF & $vrstatxt & "_" & $brojkarttxt & "_" & $imeprezimetxt & ".txt") EndFunc ;==>spremi1 Func izdane1() If FileExists($folder) Then Sleep(100) Else DirCreate($folder) EndIf Run("Explorer.exe " & @ScriptDir & "\Izdane kartice") EndFunc ;==>izdane1 Func oprogramu1() MsgBox(0, "Autor", "Darko Majetic") EndFunc ;==>oprogramu1 Func izlaz1() Exit EndFunc ;==>izlaz1 Edited November 22, 2013 by dickjones007
hannes08 Posted November 22, 2013 Posted November 22, 2013 And as I am working on a new version of _ArrayDisplay at this very moment, please do explain exactly what you would like to see - and why. Hello Melba,maybe this is a bit off-topic, but you may want to consider to add a "Cancel Script" button to that GUI. So you don't need to cancel the script via the task-bar buttons in case of debugging.Regards,Hannes Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 disregard my last request im gonna go with FileSaveDialog now question about that: what is the return value of pressing SAVE button because it does not save anything where do i define what data to save
Moderators JLogan3o13 Posted November 22, 2013 Moderators Posted November 22, 2013 Can you post your FileSaveDialog code, so we can see just what you're doing? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 (edited) FileSaveDialog("Choose a name.", @ScriptDir & "\Izdane kartice", "Text files (*.txt)", 16,$vrstatxt & "_" & $brojkarttxt & "_" & $imeprezimetxt & ".txt") in the script its in Func spremi1() at the end Edited November 22, 2013 by dickjones007
Moderators Melba23 Posted November 22, 2013 Moderators Posted November 22, 2013 dickjones007,There is no "return" as such from the Save button - it just copies the selected rows (or the whole array) into the clipboard for future use. Let me have a think about how I might implement saving to a file - but no promises. Hannes08,Not at all off-topic - I will look at that idea too. 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
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 Melba23, Im reffering to SAVE button in FileSaveDialog and not in array display
Moderators Melba23 Posted November 22, 2013 Moderators Posted November 22, 2013 dickjones007,I see. Did you look in the Help file to see what is returned from the FileSaveDialog function? Or are you expecting someone else to do it and then tell 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
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 it doesnt work for me. i took from help file this If @error Then MsgBox(4096, "", "Save cancelled.") Else MsgBox(4096, "", "You chose " & $var) EndIf replaced MsgBox(4096, "", "You chose " & $var) with _FileWriteFromArray(@ScriptDir & "Izdane kartice" & $vrstatxt & "_" & $brojkarttxt & "_" & $imeprezimetxt & ".txt", $avArray, 0,""," ") and when i press save file is not created. correct me.
Moderators Melba23 Posted November 22, 2013 Moderators Posted November 22, 2013 dickjones007,This works for me - how about you: #include <File.au3> Global $aArray[20][10], $vVar = 0 For $i = 0 To 19 For $j = 0 To 9 $aArray[$i][$j] = "Item " & StringFormat("%02i", $i) & StringFormat("%02i", $j) Next Next $sFile = FileSaveDialog("Choose a name", @ScriptDir, "Text files (*.txt)", 16, "fred.txt") If @error Then MsgBox(4096, "", "Save cancelled.") Else MsgBox(4096, "", "You chose " & $sFile) _FileWriteFromArray($sFile, $aArray) EndIfDoes that help point out the error in your own code? If not then post the whole script and I will take a look. 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
Terenz Posted November 22, 2013 Posted November 22, 2013 And as I am working on a new version of _ArrayDisplay at this very moment, please do explain exactly what you would like to see - and why. M23 I know this is OT but if you can add the optional parameter for change the label of the button "Copy to the Clipboard" for people with different OS language and *maybe* make that button customizable for other Func() and not only ClipPut() Thanks for your work Nothing is so strong as gentleness. Nothing is so gentle as real strength
dickjones007 Posted November 22, 2013 Author Posted November 22, 2013 help very much to point out my mistake thank you once again
Moderators Melba23 Posted November 22, 2013 Moderators Posted November 22, 2013 dickjones007,Glad I could help. Terenz,Language customisation is not on the menu - sorry. What sort of "other Func()" do you see as being linked to that button? User defined ones as is the case with HotKeys? Other internal Autoit functions? I am struggling to see quite what the purpose would be, so do please explain in more detail. 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
jdelaney Posted November 22, 2013 Posted November 22, 2013 (edited) Not sure if still needed, but added a button to _arraydisplay...update, added 2 buttons, save all, and save selected expandcollapse popup#include <Array.au3> #include <File.au3> local $array[5] = [1,2,3,4,5] _ArrayDisplay2($array) Exit Func _ArrayDisplay2(Const ByRef $avArray, $sTitle = "Array: ListView Display", $iItemLimit = -1, $iTranspose = 0, $sSeparator = "", $sReplace = "|", $sHeader = "") If Not IsArray($avArray) Then Return SetError(1, 0, 0) ; Dimension checking Local $iDimension = UBound($avArray, 0), $iUBound = UBound($avArray, 1) - 1, $iSubMax = UBound($avArray, 2) - 1 If $iDimension > 2 Then Return SetError(2, 0, 0) ; Separator handling If $sSeparator = "" Then $sSeparator = Chr(124) ; Check the separator to make sure it's not used literally in the array If _ArraySearch($avArray, $sSeparator, 0, 0, 0, 1) <> -1 Then For $x = 1 To 255 If $x >= 32 And $x <= 127 Then ContinueLoop Local $sFind = _ArraySearch($avArray, Chr($x), 0, 0, 0, 1) If $sFind = -1 Then $sSeparator = Chr($x) ExitLoop EndIf Next EndIf ; Declare variables Local $vTmp, $iBuffer = 4094 ; AutoIt max item size Local $iColLimit = 250 Local $iOnEventMode = Opt("GUIOnEventMode", 0), $sDataSeparatorChar = Opt("GUIDataSeparatorChar", $sSeparator) ; Swap dimensions if transposing If $iSubMax < 0 Then $iSubMax = 0 If $iTranspose Then $vTmp = $iUBound $iUBound = $iSubMax $iSubMax = $vTmp EndIf ; Set limits for dimensions If $iSubMax > $iColLimit Then $iSubMax = $iColLimit If $iItemLimit < 1 Then $iItemLimit = $iUBound If $iUBound > $iItemLimit Then $iUBound = $iItemLimit ; Set header up If $sHeader = "" Then $sHeader = "Row " ; blanks added to adjust column size for big number of rows For $i = 0 To $iSubMax $sHeader &= $sSeparator & "Col " & $i Next EndIf ; Convert array into text for listview Local $avArrayText[$iUBound + 1] For $i = 0 To $iUBound $avArrayText[$i] = "[" & $i & "]" For $j = 0 To $iSubMax ; Get current item If $iDimension = 1 Then If $iTranspose Then $vTmp = $avArray[$j] Else $vTmp = $avArray[$i] EndIf Else If $iTranspose Then $vTmp = $avArray[$j][$i] Else $vTmp = $avArray[$i][$j] EndIf EndIf ; Add to text array $vTmp = StringReplace($vTmp, $sSeparator, $sReplace, 0, 1) ; Set max buffer size If StringLen($vTmp) > $iBuffer Then $vTmp = StringLeft($vTmp, $iBuffer) $avArrayText[$i] &= $sSeparator & $vTmp Next Next ; GUI Constants Local Const $_ARRAYCONSTANT_GUI_DOCKBORDERS = 0x66 Local Const $_ARRAYCONSTANT_GUI_DOCKBOTTOM = 0x40 Local Const $_ARRAYCONSTANT_GUI_DOCKHEIGHT = 0x0200 Local Const $_ARRAYCONSTANT_GUI_DOCKLEFT = 0x2 Local Const $_ARRAYCONSTANT_GUI_DOCKRIGHT = 0x4 Local Const $_ARRAYCONSTANT_GUI_EVENT_CLOSE = -3 Local Const $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH = (0x1000 + 29) Local Const $_ARRAYCONSTANT_LVM_GETITEMCOUNT = (0x1000 + 4) Local Const $_ARRAYCONSTANT_LVM_GETITEMSTATE = (0x1000 + 44) Local Const $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE = (0x1000 + 54) Local Const $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT = 0x20 Local Const $_ARRAYCONSTANT_LVS_EX_GRIDLINES = 0x1 Local Const $_ARRAYCONSTANT_LVS_SHOWSELALWAYS = 0x8 Local Const $_ARRAYCONSTANT_WS_EX_CLIENTEDGE = 0x0200 Local Const $_ARRAYCONSTANT_WS_MAXIMIZEBOX = 0x00010000 Local Const $_ARRAYCONSTANT_WS_MINIMIZEBOX = 0x00020000 Local Const $_ARRAYCONSTANT_WS_SIZEBOX = 0x00040000 ; Set interface up Local $iWidth = 640, $iHeight = 480 Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight, Default, Default, BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX)) Local $aiGUISize = WinGetClientSize($hGUI) Local $hListView = GUICtrlCreateListView($sHeader, 0, 0, $aiGUISize[0], $aiGUISize[1] - 26, $_ARRAYCONSTANT_LVS_SHOWSELALWAYS) Local $hCopy = GUICtrlCreateButton("Copy Selected", 3, $aiGUISize[1] - 23, $aiGUISize[0]/3 - 9, 20) Local $hSaveSelected = GUICtrlCreateButton("Save Selected", (($aiGUISize[0])/3) + 6, $aiGUISize[1] - 23, $aiGUISize[0]/3 - 9, 20) Local $hSave = GUICtrlCreateButton("Save All", (2*($aiGUISize[0])/3) + 9, $aiGUISize[1] - 23, $aiGUISize[0]/3 - 9, 20) GUICtrlSetResizing($hListView, $_ARRAYCONSTANT_GUI_DOCKBORDERS) GUICtrlSetResizing($hCopy, $_ARRAYCONSTANT_GUI_DOCKLEFT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT) GUICtrlSetResizing($hSaveSelected, $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT) GUICtrlSetResizing($hSave, $_ARRAYCONSTANT_GUI_DOCKRIGHT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT) GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_GRIDLINES, $_ARRAYCONSTANT_LVS_EX_GRIDLINES) GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT) GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE) ; Fill listview For $i = 0 To $iUBound GUICtrlCreateListViewItem($avArrayText[$i], $hListView) Next ; adjust window width $iWidth = 0 For $i = 0 To $iSubMax + 1 $iWidth += GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH, $i, 0) Next If $iWidth < 250 Then $iWidth = 230 $iWidth += 20 If $iWidth > @DesktopWidth Then $iWidth = @DesktopWidth - 100 WinMove($hGUI, "", (@DesktopWidth - $iWidth) / 2, Default, $iWidth) ; Show dialog GUISetState(@SW_SHOW, $hGUI) While 1 Local $guiMsg = GUIGetMsg() Switch $guiMsg Case $_ARRAYCONSTANT_GUI_EVENT_CLOSE ExitLoop Case $hCopy,$hSaveSelected Local $sClip = "" ; Get selected indices [ _GUICtrlListView_GetSelectedIndices($hListView, True) ] Local $aiCurItems[1] = [0] For $i = 0 To GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETITEMCOUNT, 0, 0) If GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETITEMSTATE, $i, 0x2) Then $aiCurItems[0] += 1 ReDim $aiCurItems[$aiCurItems[0] + 1] $aiCurItems[$aiCurItems[0]] = $i EndIf Next ; Generate clipboard text If Not $aiCurItems[0] Then For $sItem In $avArrayText $sClip &= $sItem & @CRLF Next Else For $i = 1 To UBound($aiCurItems) - 1 $sClip &= $avArrayText[$aiCurItems[$i]] & @CRLF Next EndIf If $hSaveSelected = $guiMsg Then $sFile = FileSaveDialog("Choose a name", @ScriptDir, "Text files (*.txt)", 16, "fred.txt") If @error Then MsgBox(4096, "", "Save cancelled.") Else MsgBox(4096, "", "You chose " & $sFile) _FileCreate($sFile) FileWrite($sFile,$sClip) EndIf Else ClipPut($sClip) EndIf Case $hSave $sFile = FileSaveDialog("Choose a name", @ScriptDir, "Text files (*.txt)", 16, "fred.txt") If @error Then MsgBox(4096, "", "Save cancelled.") Else MsgBox(4096, "", "You chose " & $sFile) _FileWriteFromArray($sFile, $avArray) EndIf EndSwitch WEnd GUIDelete($hGUI) Opt("GUIOnEventMode", $iOnEventMode) Opt("GUIDataSeparatorChar", $sDataSeparatorChar) Return 1 EndFunc ;==>_ArrayDisplay Edited November 22, 2013 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.
Gianni Posted November 22, 2013 Posted November 22, 2013 (edited) ........ And as I am working on a new version of _ArrayDisplay at this very moment, please do explain exactly what you would like to see - and why. M23 .... could you please add support for 3D array (or even better, multidimensional array..... ) I'm kidding Edited November 22, 2013 by PincoPanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
jdelaney Posted November 22, 2013 Posted November 22, 2013 ha, it's been done others have as well 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.
Gianni Posted November 23, 2013 Posted November 23, 2013 ..... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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