Jump to content

Recommended Posts

Posted

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.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

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 editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted (edited)

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

I feel nothing.It feels great.

  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

ileandros,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted (edited)

ileandros,

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

M23

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

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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.

Posted

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.

  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

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

I feel nothing.It feels great.

  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

( ;) = ( , ; , ) 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

I feel nothing.It feels great.

Posted

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.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

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 editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

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.

  • Moderators
Posted

ileandros,

Now you have explained what you want - here is how you might do it: :)

#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? ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...