Restored from previous forum. Originally posted by WolfgangS.
Hi !
if you use a requester to get the file of your choice you get always the path AND the name. To extract the name out from the whole Path+Name try this procedure ...
FileNameWithExtension.s=""
Procedure.s GetFilenameWithoutPath(PAN$) ; Path And Name
For i=1 To Len(PAN$)
If Mid(PAN$,Len(PAN$)-i,1)="\"
ProcedureReturn(Right(PAN$,i))
EndIf
Next
ProcedureReturn(Right(PAN$,i))
EndProcedure
OpenConsole()
FileNameWithExtension=OpenFileRequester("","","",0)
PrintN("WholePath+Name = "+FileNameWithExtension)
PrintN("Just the Name = "+GetFilenameWithoutPath(FileNameWithExtension))
Delay(50000)
Restored from previous forum. Originally posted by PB.
> OpenConsole()
> FileNameWithExtension=OpenFileRequester("","","",0)
> Printn("WholePath+Name = "+FileNameWithExtension)
> PrintN("Just the Name = "+GetFilenameWithoutPath(FileNameWithExtension))
> Delay(50000)
Another tip: You don't need to open a Console to print information like you have
above... just use the Debug command instead; it saves a lot of typing:
Debug "WholePath+Name = "+FileNameWithExtension
Debug "Just the Name = "+GetFilenameWithoutPath(FileNameWithExtension)
Restored from previous forum. Originally posted by fred.
DOH !
this is embarrassing ... please don't comment ... :*|
No problem. Its proves than the PB docs isn't perfect (Ok, ok, everybody already knows it). I will add a link to this command in the OpenFileRequester() doc.