Jump to content

Recommended Posts

Posted (edited)

I am using a similar way but look what is my problem.

Here ur setting the data at the end like this

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            ; If there is a selection to delete
            If GUICtrlRead($cLabel) <> "" Then
                ; Which one is it
                $iIndex = _GUICtrlListBox_SelectString($cList, GUICtrlRead($cLabel))
                ; Delete it
                _GUICtrlListBox_DeleteString($cList, $iIndex)
                ; Clear the label
                GUICtrlSetData($cLabel, "")
            EndIf
    EndSwitch
WEnd

This is how you set the data.

GuiCtrlSetData($cLabel, "")
This is a nice way but its only use when you want to clear the entire field.

In my case i have more than 1 $cLabel added at my list and when i use it, it clears the filed and deletes everything.

I want to make it delete the spesific $cLabel that is chosen/clicked in case i have more than 1 item added and not clear everything...

Edited by ileandros

I feel nothing.It feels great.

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I found the solution :oops:

case $BtnRemove
            $Deleteitem = GUICtrlRead($ListBoxToExecute)
            If StringStripWS($Deleteitem, 8) Then
                GUICtrlSetData($ListBoxToExecute, $Deleteitem)
                $iSel = _GUICtrlListBox_GetCurSel($ListBoxToExecute)
                _GUICtrlListBox_DeleteString($ListBoxToExecute, $iSel)
            EndIf

I feel nothing.It feels great.

Posted

ileandros,

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

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. :bye:

M23

Is there a way to make ur command
$aArray = _RecFileListToArray($sPath, "*.exe;*.bat;*.au3", 1)

work with a checkbox???

I mean insteed of adding ("*.exe;*.bat;*.au3",) at the code can i make a checkbox for each of these and make the command check only these that are checked from the checkboxes??

I feel nothing.It feels great.

Posted

Yes, you can create a GUI with check boxes that you can then read to see if checked, and add the filters to the list by using a variable instead of an absolute string.

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,

Something like this perhaps? :bye:

#include <GUIConstantsEx.au3>

Global $aCheck[3]

$hGUI = GUICreate("Test", 500, 500)

$aCheck[0] = GUICtrlCreateCheckbox("*.bat", 10, 10, 100, 20)
$aCheck[1] = GUICtrlCreateCheckbox("*.exe", 10, 30, 100, 20)
$aCheck[2] = GUICtrlCreateCheckbox("*.au3", 10, 50, 100, 20)

$cButton = GUICtrlCreateButton("Go", 10, 100, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            $sExt_String = ""
            For $i = 0 To 2
                If GUICtrlRead($aCheck[$i]) = 1 Then
                    ; Add the type to the string wit the delimiter
                    $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";"
                EndIf
            Next
            If $sExt_String <> "" Then
                ; Remove the final ;
                $sExt_String = StringTrimRight($sExt_String, 1)
            EndIf

            MsgBox(0, "And you get....", $sExt_String)

    EndSwitch

WEnd

Then you can use that string in the _RecFileListToArray call. :oops:

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

I dont know why the heck but i dont get it.

This is how i had it working before.

Case $fileitem1
 GUICtrlSetData($ListProg, "")
 $sPath = StringReplace(@TempDir, " ", "")
 $aFiles = _RecFileListToArray($sPath, " *.* ", 1)
  For $i = 1 To $aFiles[0]
   GUICtrlSetData($ListProg, $aFiles[$i])
  Next

When i add ur script i have to empty this part right???

$aFiles = _RecFileListToArray($sPath, " EMPTY ", 1)

so the type can be chosen from the checkbox but i got error when i have it EMPTY :/

I feel nothing.It feels great.

  • Moderators
Posted

ileandros,

So set a default value of *.* if no checkboxes are ticked: :oops:

#include <GUIConstantsEx.au3>

Global $aCheck[3]

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateLabel("Select extension (Default = *.*)", 10, 10, 200, 20)

$aCheck[0] = GUICtrlCreateCheckbox("*.bat", 10, 50, 100, 20)
$aCheck[1] = GUICtrlCreateCheckbox("*.exe", 10, 70, 100, 20)
$aCheck[2] = GUICtrlCreateCheckbox("*.au3", 10, 90, 100, 20)

$cButton = GUICtrlCreateButton("Go", 10, 200, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            $sExt_String = ""
            For $i = 0 To 2
                If GUICtrlRead($aCheck[$i]) = 1 Then
                    ; Add the type to the string wit the delimiter
                    $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";"
                EndIf
            Next
            If $sExt_String <> "" Then
                ; Remove the final ;
                $sExt_String = StringTrimRight($sExt_String, 1)
            Else
                ; Set default if empty
                $sExt_String = "*.*" ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            EndIf

            MsgBox(0, "And you get....", $sExt_String)

    EndSwitch

WEnd

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

puta!!!!!!!!!!!!!!

The problem is that it doesn't work. For me at least.

The problem is that when i use the @TempDir nagivate it is set to *.exe because i cant have it empty since i have an error.

and when checkbox is ticked it doesnt navigate for the checkbox only for the .exe

How can i combine mine with ur to make it damn work ???

I feel nothing.It feels great.

  • Moderators
Posted

ileandros,

Perhaps like this? :oops:

#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <RecFileListToArray.au3>

Global $aCheck[3]

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateLabel("Select extension (Default = *.*)", 10, 10, 200, 20)

$aCheck[0] = GUICtrlCreateCheckbox("*.bat", 10, 50, 100, 20)
$aCheck[1] = GUICtrlCreateCheckbox("*.exe", 10, 70, 100, 20)
$aCheck[2] = GUICtrlCreateCheckbox("*.au3", 10, 90, 100, 20)

$cButton = GUICtrlCreateButton("Go", 10, 200, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            $sExt_String = ""
            For $i = 0 To 2
                If GUICtrlRead($aCheck[$i]) = 1 Then
                    ; Add the type to the string with the delimiter
                    $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";"
                EndIf
            Next
            If $sExt_String <> "" Then
                ; Remove the final ;
                $sExt_String = StringTrimRight($sExt_String, 1)
            Else
                ; Set default if empty
                $sExt_String = "*.*"
            EndIf

            ; This is what we are looking for
            MsgBox(0, "Searching for...", $sExt_String)

            $sPath = StringReplace(@TempDir, " ", "")
            $aFiles = _RecFileListToArray($sPath, $sExt_String, 1)

            ; And this is what we found
            If @error Then
                MsgBox(0, "Ooops!", "No files found in " & $sPath)
            Else
                _ArrayDisplay($aFiles, $sPath)
            EndIf

    EndSwitch

WEnd

M23

P.S. Are you actually going to write part of this script at some point in the process or am I going to do it all? :bye:

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

P.S. Are you actually going to write part of this script at some point in the process or am I going to do it all? :bye:

I do believe you qualify as a rent-a-coder after 15 answers :oops:

"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!

Posted

I did a similar before but i dont know how to set it at the listbox after.

You display it with an array i want to display it at my listbox $list1 but i cant.

Thats why im getting errors im trying different ways :/

I feel nothing.It feels great.

  • Moderators
Posted

ileandros,

We have discussed how to get elements from an array into a list before - and you have even posted the code yourself in your post #47 above: :oops:

$aFiles = _RecFileListToArray($sPath, " *.* ", 1)
For $i = 1 To $aFiles[0]
    GUICtrlSetData($ListProg, $aFiles[$i])
Next

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)

YES!!!!!!!!!!!!!!!!!!

I made it work. It has to be like this!

Case $fileitem1
  $sExt_String = ""
            For $i = 0 To 1
                If GUICtrlRead($aCheck[$i]) = 1 Then
                    ; Add the type to the string with the delimiter
                    $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";"
                EndIf
            Next
            If $sExt_String <> "" Then
                ; Remove the final ;
                $sExt_String = StringTrimRight($sExt_String, 1)
            Else
                ; Set default if empty
                $sExt_String = "*.*"
            EndIf
            ; This is what we are looking for
            MsgBox(0, "Searching for...", $sExt_String)
            $sPath = StringReplace(@TempDir, " ", "")
            $aFiles = _RecFileListToArray($sPath, $sExt_String, 1)
   For $i = 1 To $aFiles[0]
   GUICtrlSetData($List1, $aFiles[$i])
  Next
            ; And this is what we found
            If @error Then
                MsgBox(0, "Ooops!", "No files found in " & $sPath)
EndIf

You made it work :oops: (Melba23)

Edit: i got an error. If the chosen type of files doesn't exists i dont get this that is supposed to do

If @error Then
MsgBox(0, "Ooops!", "No files found in " & $sPath)
EndIf

but i get this error message

C:Program Filesoffice.au3officeNew.au3 (107) : ==> Subscript used with non-Array variable.:
For $i = 1 To $aFiles[0]
For $i = 1 To $aFiles^ ERROR
->19:27:09 AutoIT3.exe ended.rc:1
>Exit code: 1    Time: 7.994
Edited by ileandros

I feel nothing.It feels great.

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...