Jump to content

Recommended Posts

Posted

i dont know how i would start...or search this.

how would i make the drop down a list of .ini files saved in a certain directory

.ini files would constantly be being added/removed after each use of the program not while it is running.

i dont know if i explained well enough

files in folder

-file1.ini

-file2.ini

-file3.ini

combobox

blank on start

when click down

|combobox \/|

|file1.ini |

|file2.ini |

|file3.ini |

Posted (edited)

Use FileFindFirstFile and FileFindNextFile to get the .ini files in the folder, then just append them all together to generate the input parameter for the combobox.

You can also use _FileListToArray to dump the filenames into an array then proceed from there.

Edited by omikron48
Posted

From the help file, did change

_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")

to

_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.ini")

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hCombo

    ; Create GUI
    GUICreate("ComboBox Add Dir", 400, 296)
    $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    GUISetState()

    ; Add files
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.ini")
    _GUICtrlComboBox_EndUpdate($hCombo)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc ;==>_Main
Posted

that works but do you know how i would get rid of the .ini on the end of them?

i've looked through _GUICtrlComboBox in the help file but cant find anything

Posted

Do a stringsplit() with "." as the seperator. :)

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

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
  • Recently Browsing   0 members

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