Jump to content



Photo

How to read items??


  • Please log in to reply
53 replies to this topic

#21 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,803 posts

Posted 22 February 2012 - 09:16 PM

You can't filter the file list very well with _FIleListToArray because it only accepts one filename and/or extension to look for (using wildcards), you'd need to use something like Melba23's _RecFileListToArray and put in every type of file you want to look for, such as *.exe, *.bat, *.au3 etc.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image






#22 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 09:40 PM

Ok thank you all for your BIG help :)
I feel nothing.It feels great.

#23 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 10:23 PM

Melba23 you helped me and you gave me this code
$sPath = StringReplace(@DesktopDir, "AutoIt3.exe", "") $aFiles = _FileListToArray($sPath, "*.*", 1) For $i = 1 To $aFiles[0] GUICtrlSetData($List1, $aFiles[$i]) Next

If i change this is it possible to make it load spesific kind of files???
$aFiles = _FileListToArray($sPath, ".log", 1)

or whatever files img, txt etc..

Edited by ileandros, 22 February 2012 - 10:23 PM.

I feel nothing.It feels great.

#24 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 22 February 2012 - 10:30 PM

ileandros,

You would need to use "*.log" as the mask and run it again for each separate extension. :)

But if you use my RecFileListToArray UDF you can search for several extensions in one pass, as BrewManNH suggested above:
$aArray = _RecFileListToArray($sPath, "*.exe;*.bat;*.au3", 1)

And the UDF will also search within subfolders if you wish. ;)

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#25 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 10:35 PM

yes but i got the same error as the one commented on you.
I cant read the
#include "RecFileListToArray"

I feel nothing.It feels great.

#26 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 22 February 2012 - 10:38 PM

ileandros,

Have you downloaded the UDF and put in the same folder as the script? :)

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#27 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 10:47 PM

yes
I feel nothing.It feels great.

#28 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 22 February 2012 - 10:49 PM

ileandros,

So what exactly is the "error" you get? :)

M23

Edit: You need #include "RecFileListToArray.au3" - does that help? ;)

Edited by Melba23, 22 February 2012 - 10:50 PM.

StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#29 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 11:04 PM

yes i did it but i had some other error besides that.
I corrected all the errors the only prob now that it doesnt load any files...
I feel nothing.It feels great.

#30 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 11:08 PM

ahhh fixed it.
I used ur method but with the code ur giving above it only read .exe why not the others since they are in the code???
I feel nothing.It feels great.

#31 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 22 February 2012 - 11:11 PM

Fixed that too :)
Why ate the 2 first there is ; and tha the last (au3) there is not???
I feel nothing.It feels great.

#32 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 23 February 2012 - 08:45 AM

ileandros,

I have no idea - do you have files with all 3 extensions in the folder you are searching? :)

As usual in your threads I find I have to ask you to post the code you have been using - please help us to help you. ;)

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#33 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 24 February 2012 - 12:54 PM

No i have no problems i made it work ;)
I just asked why there is this ( :) after the exe and bat
$aArray = _RecFileListToArray($sPath, "*.exe;*.bat;*.au3", 1)

in ur method.
Just a question for information nothing more.

Edited by ileandros, 24 February 2012 - 12:56 PM.

I feel nothing.It feels great.

#34 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 24 February 2012 - 01:16 PM

ileandros,

I understand now - I added the .au3 because BrewManNH had used those 3 extensions in his post at the top of the page. :)

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#35 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 24 February 2012 - 01:55 PM

( ;) = ( , ; , ) i am asking why this ; exist at exe and bat and not at the au3???? :)



P.S. this is the control to set the state of something
GUICtrlRead($test) GUICtrlSetData($test, $test1)


What the heck is the command to undothat.
i dont mean this
GUICtrlRead($test) GUICtrlSetData($test, " " )

I mean to remove 1 item not to clear the $test state

Edited by ileandros, 24 February 2012 - 02:03 PM.

I feel nothing.It feels great.

#36 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,803 posts

Posted 24 February 2012 - 02:11 PM

The ";" is used to separate the filters, because .au3 is the last one in the list, there's nothing needed to separate it from anything else.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#37 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 24 February 2012 - 02:59 PM

ileandros,

Obviously I did not understand - but neither did you read the function header for _RecFileListToArray where it clearly states:
$sInclude_List - Optional: filter for included results (default "*"). Multiple filters must be separated by ";"

So I reckon we are even at worst. ;)

For your next question - what do you mean by "remove 1 item"? Do you mean delete the control entirely? If so then GUICtrlDelete is what you are looking for. :)

If not, then please explain in slightly less cryptic terms. I realise English is not your first language, but it woudl help us help you if you explained your problems in a bit more detail when you post. A few words and a couple of lines of code is often not enough to let us guess what you are actually looking for - as evidenced by many of the earlier posts in this thread. ;)

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#38 kylomas

kylomas

    Want to see God laugh? Tell him you have plans!

  • Active Members
  • PipPipPipPipPipPip
  • 2,036 posts

Posted 24 February 2012 - 05:11 PM

ileandros,

IF you want to handle populating controls with GuiCtrlSetData than you need to manipulate the variable "$test1" and re-populate the control "$test" at every change.

kylomas
"Really?, How Do you know the're not random numbers?"Forum Rules

#39 ileandros

ileandros

    Universalist

  • Banned (NOT IN USE)
  • 592 posts

Posted 25 February 2012 - 12:00 AM

Well i set the data of a list with GuiCtrlSetData. Which means i fill a list with items. I want to know how t remone items from the list. How to delete. Which is the commamd to do that...? I wad looking at the help files but didnt manage to find it. And sorry for my english. Im good but i type quick and i talk simple :)
I feel nothing.It feels great.

#40 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,305 posts

Posted 25 February 2012 - 08:19 AM

ileandros,

Now you have explained what you want - here is how you might do it: :)
AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> #include <GuiListBox.au3> #include <File.au3> ; Get the path of the AutoIt exe $sPath = StringReplace(@AutoItExe, "AutoIt3.exe", "") ; Read all the files on that path into an array $aFiles = _FileListToArray($sPath, "*.*", 1) ; Create a GUI $hGUI = GUICreate("Test", 500, 500) ; Create a list $cList = GUICtrlCreateList("", 10, 10, 200, 200) ; And fill it with our data For $i = 1 To $aFiles[0]     GUICtrlSetData($cList, $aFiles[$i]) Next ; Create a button and label $cButton = GUICtrlCreateButton("Delete", 10, 300, 80, 30) $cLabel = GUICtrlCreateLabel("", 100, 310, 200, 20) GUISetState() ; Look for doubleclicks on the list GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit         Case $cButton             ; If there is a selection to delete             If GUICtrlRead($cLabel) <> ""                 ; Which one is it                 $iIndex = _GUICtrlListBox_SelectString($cList, GUICtrlRead($cLabel))                 ; Delete it                 _GUICtrlListBox_DeleteString($cList, $iIndex)                 ; Clear the label                 GUICtrlSetData($cLabel, "")             EndIf     EndSwitch WEnd Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)     Local $nCode = BitShift($wParam, 16)        ; HiWord     Local $nIDFrom = BitAND($wParam, 0xFFFF)    ; LoWord     Switch $nIDFrom         ; If from the list         Case $cList             Switch $nCode                 ; If a double click                 Case $LBN_DBLCLK                     ; Read selected item                     $sListItem = GUICtrlRead($cList)                     ; Display selected item                     GUICtrlSetData($cLabel, $sListItem)             EndSwitch     EndSwitch     Return $GUI_RUNDEFMSG EndFunc   ;==>_WM_COMMAND

As I have said to you many times before - help us to help you. Take the time to explain the problem you are having, perhaps even write a small reproducer script. A couple of cryptic remarks and a few lines of code do not allow us to do much other than offer guesses or simply ask for a better explanation. Many of the posts in this thread are only there because we needed to drag more information out of you - my typing fingers and keyboard would be grateful for more explanation from you initially. OK? ;)
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users