Jump to content
Sign in to follow this  
Floppy

Help with this SCRIPT

Recommended Posts

Floppy

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]

Share this post


Link to post
Share on other sites
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Floppy

Thank you very much....now works fine

Share this post


Link to post
Share on other sites
wolf9228

#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 by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
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
Sign in to follow this  

×