Jump to content

Library View + add and dealet buttons <<!!! Help


Guest AX5
 Share

Recommended Posts

Hiho all...

Howe do i make so Button1 and list1 is coupled so when i choose a folder i see the files in list1 and button3 to Move the selected file in List1 to another dir. and remove to remove selected file in List 1

This is my script

$Form1 = GUICreate("Demo Manager", 427, 296, 231, 155)
$Button1 = GUICtrlCreateButton("Choose a folder", 272, 88, 113, 33, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Move", 272, 168, 113, 33, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Remove", 272, 208, 113, 33, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Select a file", 115, 42, 60, 15)
$List1 = GUICtrlCreateList("List here", 32, 72, 225, 201)
$Pic1 = GUICtrlCreatePic("img/bg.jpg", 0, 0, 427, 296, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            $var = FileSelectFolder("Choose a folder.", "")
        Case $Button2

        Case $Button3

        Case $Button4
            FileDelete("")
    EndSwitch
WEnd
Edited by AX5
Link to comment
Share on other sites

  • Moderators

AX5,

Howe do i make so Button1 and list1 is coupled so when i choose a folder i see the files in list1

1. Use FileListToArray to list the files in the chosen folder - GUICtrlSetData will get the names into the list (once they are correctly formatted - you will need a loop :evil: ).

and button3 to Move the selected file in List1 to another dir. and remove to remove selected file in List 1

FileMove and FileDelete/FileRecycle will be a great help here!

Dog eaten your help file over Xmas? ;)

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

 

Link to comment
Share on other sites

AX5,

1. Use FileListToArray to list the files in the chosen folder - GUICtrlSetData will get the names into the list (once they are correctly formatted - you will need a loop :evil: ).

FileMove and FileDelete/FileRecycle will be a great help here!

Dog eaten your help file over Xmas? ;)

M23

Thx for the helpt but can u show me howe to connect them first button ?

Link to comment
Share on other sites

  • Moderators

AX5,

Seven months a member here and you cannot do this yourself? :evil:

Case $Button1
    List_Folder_Contents()
;.....

Func List_Folder_Contents()

    ; Choose folder
    $sFolderPath = FileSelectFolder("Choose a folder", "M:\")
    If $sFolderPath = "" Then Return ; No folder chosen
    ; Clear list
    GUICtrlSetData($List1, "|")
    ; List contents into array
    $aFile_Array = _FileListToArray($sFolderPath, "*", 1)
    ; If no files found
    If @error Then
        GUICtrlSetData($List1, "|No files found!")
        Return
    EndIf
    ; Move found files into list
    For $i = 1 To $aFile_Array[0]
        GUICtrlSetData($List1, $aFile_Array[$i])
    Next

EndFunc

Have fun with the other buttons! ;)

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

 

Link to comment
Share on other sites

Im geting error on script button1

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Demo Manager", 427, 296, 231, 155)
$Button1 = GUICtrlCreateButton("Choose a folder", 272, 110, 113, 33, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Move", 272, 168, 113, 33, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Remove", 272, 208, 113, 33, $WS_GROUP)
$Label1 = GUICtrlCreateLabel(" File Display", 115, 52, 60, 15)
$List1 = GUICtrlCreateList("List here", 32, 72, 225, 201)
$Pic1 = GUICtrlCreatePic("img/background.jpg", 0, 0, 427, 296, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            Case $Button1
    List_Folder_Contents()


Func List_Folder_Contents()

    ; Choose folder
    $sFolderPath = FileSelectFolder("Choose a folder", "M:\")
    If $sFolderPath = "" Then Return ; No folder chosen
    ; Clear list
    GUICtrlSetData($List1, "|")
    ; List contents into array
    $aFile_Array = _FileListToArray($sFolderPath, "*", 1)
    ; If no files found
    If @error Then
        GUICtrlSetData($List1, "|No files found!")
        Return
    EndIf
    ; Move found files into list
    For $i = 1 To $aFile_Array[0]
        GUICtrlSetData($List1, $aFile_Array[$i])
    Next

EndFunc


        Case $Button3

        Case $Button4
            FileDelete("")
    EndSwitch
WEnd

don't understand the error

Link to comment
Share on other sites

  • Developers

Put the Func at the end of your script, not inside the Select case!

Also answer the PM I send because I am still waiting an a good explanation.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

afther EndSwitch ?

Stop asking and start trying/learning/reading ... it is not kiddies garden here!

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

AX5,

You do it like this: :evil:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Demo Manager", 427, 296, 231, 155)
$Button1 = GUICtrlCreateButton("Choose a folder", 272, 110, 113, 33, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Move", 272, 168, 113, 33, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Remove", 272, 208, 113, 33, $WS_GROUP)
$Label1 = GUICtrlCreateLabel(" File Display", 115, 52, 60, 15)
$List1 = GUICtrlCreateList("List here", 32, 72, 225, 201)
$Pic1 = GUICtrlCreatePic("img/background.jpg", 0, 0, 427, 296, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            List_Folder_Contents()

        Case $Button3

        Case $Button4
            FileDelete("")
    EndSwitch
WEnd

Func List_Folder_Contents()

    ; Choose folder
    $sFolderPath = FileSelectFolder("Choose a folder", "M:\")
    If $sFolderPath = "" Then Return ; No folder chosen
    ; Clear list
    GUICtrlSetData($List1, "|")
    ; List contents into array
    $aFile_Array = _FileListToArray($sFolderPath, "*", 1)
    ; If no files found
    If @error Then
        GUICtrlSetData($List1, "|No files found!")
        Return
    EndIf
    ; Move found files into list
    For $i = 1 To $aFile_Array[0]
        GUICtrlSetData($List1, $aFile_Array[$i])
    Next

EndFunc

Now before you post again, you need to get a much better handle on some of the basics of AutoIt, because you patently have no idea of how to use it. Try the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you prefer watching to reading.

A little time spent studying now will pay benefits in the long run - believe me! :evil:

M23

Edit:

Apologies - you need to add another #include file (File.au3) to get _FileReadToArray to work. ;) I have amended the code above.

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

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...