Jump to content

Help with this SCRIPT


Floppy
 Share

Recommended Posts

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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Developers

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

#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

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

 

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...