Floppy Posted January 23, 2009 Share Posted January 23, 2009 Hi, I'm writed this script that reads all the file names with .lang extension in the directory "lang" and shows them in a combo-box without the extension (.lang). The problem is that the extension .lang is showed in the combo-box. (I don't know why) #include <GuiConstants.au3> #Include <File.au3> AutoItSetOption("TrayMenuMode",1) $settings_gui=GUICreate("Settings",320,200) GUICtrlCreateLabel("Language:",10,10,100,20) $lang=GUICtrlCreateCombo("English",110,8,200,20) $list_lang=_FileListToArray(@scriptdir&"\lang\","*.lang",1) If Not @error Then For $i=1 To UBound($list_lang) -1 StringReplace($list_lang[$i],".lang","") GUICtrlSetData($lang,$list_lang[$i]) Next Else GUICtrlSetData($lang,"English","English") EndIf .... Can anyone help me? Thanks [sorry for english] Link to comment Share on other sites More sharing options...
water Posted January 23, 2009 Share Posted January 23, 2009 You have to store the changed string somewhere .. $list_lang[$i] = StringReplace($list_lang[$i],".lang","") My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
picaxe Posted January 23, 2009 Share Posted January 23, 2009 OrGUICtrlSetData($lang,StringReplace($list_lang[$i],".lang","")) Link to comment Share on other sites More sharing options...
Floppy Posted January 24, 2009 Author Share Posted January 24, 2009 Thank you very much....now works fine Link to comment Share on other sites More sharing options...
Kip Posted January 24, 2009 Share Posted January 24, 2009 FSoft, start making up good titles for your posts. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 24, 2009 Developers Share Posted January 24, 2009 FSoft, start making up good titles for your posts... and you could stop the lecturing when this is the only way you contribute ? 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 More sharing options...
wolf9228 Posted January 24, 2009 Share Posted January 24, 2009 (edited) #include <Array.au3> $Array = File_extension_ListToArray() _ArrayDisplay($Array,"ListToArray") Func File_extension_ListToArray($extension = "au3" ,$Pat_source_dir = @MyDocumentsDir) FileChangeDir ( $Pat_source_dir ) Dim $List[1][4] $List[0][0] = 0 $List[0][1] = "file" $List[0][2] = "file/extension" $List[0][3] = "attributes" $search = FileFindFirstFile("*." & $extension) If $search = -1 Then _ MsgBox(0, "Error", "No files/directories matched the search pattern") While 1 $file = FileFindNextFile($search) If @error Then ExitLoop ReDim $List[$List[0][0] + 2][4] $List[$List[0][0] + 1][1] = StringTrimRight($file, StringLen($extension) + 1) $List[$List[0][0] + 1][2] = $file $List[$List[0][0] + 1][3] = FileGetAttrib($file) $List[0][0] = $List[0][0] + 1 WEnd FileClose($search) FileChangeDir ( @ScriptDir ) Return $List EndFunc Edited January 24, 2009 by wolf9228 صرح السماء كان هنا Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now