Sign in to follow this  
Followers 0
Floppy

Help with this SCRIPT

7 posts in this topic

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



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you very much....now works fine

Share this post


Link to post
Share on other sites

FSoft, start making up good titles for your posts.

.. and you could stop the lecturing when this is the only way you contribute ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 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  
Followers 0