Jump to content

Recommended Posts

Posted (edited)

In my program I have a file list tool, is there a way to make it so it doesn't display the file extension?

Case $msg = $msimple
    $tool = "simple"
        GUICtrlSetData($mlist,"")
        
        
        $mfile = FileExists ("t:\Documents and settings\Allen Penrod\desktop\database copy\molds\" & guictrlread($mmn) & "*.pdf")
        If $mfile = 1 Then
            
If $status = "Administrator" then
    guictrlsetstate($medit,$gui_show + $gui_enable)
    guictrlsetstate($madd,$gui_show + $gui_enable)
EndIf
            GUICtrlSetState($mlist, $gui_show + $gui_enable)
            GUICtrlSetState($mfileselect, $gui_show + $gui_enable)
            $mfound = FileFindFirstFile("t:\Documents and settings\Allen Penrod\desktop\database copy\molds\" & guictrlread($mmn) & "*.pdf")
            While 1 
                $mfoundnext = FileFindNextFile($mfound)
                if @error Then ExitLoop
                GUICtrlSetData($mlist,$mfoundnext & "|")
            WEnd
            FileClose($mfound)
        ElseIf $mfile = 0 Then
            MsgBox (0,"File Not Found", "File Not Found")
        EndIf
    
    Call("master")
Edited by youknowwho4eva

Giggity

Posted

Hi!

This little function removes the file extension :)

MsgBox(0,"",_RemoveFileExt("somefile.mp3"))
Func _RemoveFileExt($string)
    Return StringLeft($string,StringInStr($string,".",Default,-1)-1)
EndFunc

>_<

Broken link? PM me and I'll send you the file!

Posted

I have another problem. The problem is on one of my lists the file names are like M002-all. but if there are multiple files on the same product the next file is M002-all-2. if I use -all as my string item to search for it doesn't show all the files, and if I just have - it will show -all on all the multiple files. I think the best solution for this list is change it to just show the first 4 characters(as I have looked up this tool in the help and figured out how it works) but if I weren't so lucky to have all the file names be 4 characters, is there a way to do the same thing? Possibly from the right side?

Giggity

Posted

I have another problem. The problem is on one of my lists the file names are like M002-all. but if there are multiple files on the same product the next file is M002-all-2. if I use -all as my string item to search for it doesn't show all the files, and if I just have - it will show -all on all the multiple files. I think the best solution for this list is change it to just show the first 4 characters(as I have looked up this tool in the help and figured out how it works) but if I weren't so lucky to have all the file names be 4 characters, is there a way to do the same thing? Possibly from the right side?

I don't understand, could you provide an example before->after

Broken link? PM me and I'll send you the file!

Posted

I need it to be able to handle files that are named M002-all.pdf and M002-all-2 to come out to M002

MsgBox(0,"Test 1",_RemoveFileExt("M002-all.pdf"))
MsgBox(0,"Test 2",_RemoveFileExt("M002-all-2"))
Func _RemoveFileExt($string)
    Return StringLeft($string,StringInStr($string,"-all")-1)
EndFunc

Broken link? PM me and I'll send you the file!

Posted

When I tried that before, for some reason it cut out a lot of the results. All the results end in either -all or -all-#. But it knocks out atleast half of the results. *slaps self in the forehead* why not change the stringinstr to search from the left instead of from the right. that worked with "-". Why doesn't -all work though?

Giggity

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