Jump to content

FileOpenDialog to choose folder(s) ?


Recommended Posts

Hi, i would like to get a dialog prompt to choose files / folders and then save the path of the chosen stuff into some .ini file.

Not sure how to safe the path of the select files aswell as how to choose folders with that dialog (right now i can only open folders)

thanks :huh2:

Link to comment
Share on other sites

  • Moderators

aphesia,

For files use FileOpenDialog.

For folders use FileSelectFolder.

Save the function return in a variable and then use IniWrite to put it into an ini file.

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

aphesia,

For files use FileOpenDialog.

For folders use FileSelectFolder.

Save the function return in a variable and then use IniWrite to put it into an ini file.

M23

Thanks.. fileselectfolder was exactly what i was looking for (well a dialog for files & folder at the same time would be even better but its fine :huh2:)

however, when doing multi-selects, the ini looks like this:

test1=C:\Users\Patrick\Documents\AutoIt|script.au3|Settings.ini

but i would need it like this:

test1=C:\Users\Patrick\Documents\AutoIt\script.au3
test2=C:\Users\Patrick\Documents\AutoIt\Settings.ini

@edit: on top of that i would need every line from the ini to be written into an editbox but when deleting a line or editing a line inside the editbox, it should also change inside the ini. I guess i need to use an array here?

Edited by aphesia
Link to comment
Share on other sites

  • Developers

but i would need it like this:

test1=C:\Users\Patrick\Documents\AutoIt\script.au3
test2=C:\Users\Patrick\Documents\AutoIt\Settings.ini

@edit: on top of that i would need every line from the ini to be written into an editbox but when deleting on line or editing a line inside the editbox, it should also change inside the ini. I guess i need to use an array here?

Ok, so you expect it all to be coded for you or did you need help with what you already have tried?

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

aphesia,

Look at StringSplit - then you can separate the various parts of the returned string and then concatenate them when writing the ini file. ;)

a dialog for files & folder at the same time would be even better but its fine )

You could use my ChooseFileFolder UDF to do both things with the same dialog. :huh2:

M23

Edit: Typnig!

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

I wrote this... but i think is useless now :\

$var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $OnlyFileName = StringSplit($var,"\")
    $OnlyFolder = StringTrimRight($var,StringLen($OnlyFileName[ubound($OnlyFileName)-1]))
    MsgBox(4096,"","You chose " & $OnlyFileName[ubound($OnlyFileName)-1])
    MsgBox(4096,"","You chose " & $OnlyFolder)
EndIf
sorry i arrive later...
Link to comment
Share on other sites

@Jobs: no not really i was just looking for Stringsplit and other commands which i didnt know/couldnt find.. and propably an idea on how to do that stuff with the editbox & the line-by-line read/write from an .ini

@melba23: thanks alot.. stringsplit seems to be exactly what i was looking for.. will try it out as soon as i come home from work :huh2: also that udf sounds great !

@monoscout: np still you helped me out cause i didnt knew how to use multiple options (e.g. 1 and 4) in the fileopendialog.. but you just showed me how to ;D

$var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )
Edited by aphesia
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...