PowerBasic Museum 2020-A

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Windows Script Runtime => Source Code => Scripting => FileSystemObject => Topic started by: José Roca on July 14, 2008, 02:41:52 AM

Title: IFileSystem.GetExtensionName Method
Post by: José Roca on July 14, 2008, 02:41:52 AM


The following example illustrates the use of the GetExtensionName method.

JScript


function GetAnExtension(filespec)
{
   var fso, s = "";
   fso = new ActiveXObject("Scripting.FileSystemObject");
   s += fso.GetExtensionName(filespec);
   return(s);
}


VBScript


Function GetAnExtension(DriveSpec)
   Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
   GetAnExtension = fso.GetExtensionName(Drivespec)
End Function


PowerBASIC


FUNCTION GetAnExtension (BYVAL strDriveSpec AS STRING) AS STRING

   LOCAL fso AS IFileSystem

   fso = NEWCOM ("Scripting.FileSystemObject")
   FUNCTION = ACODE$(fso.GetExtensionName(strDrivespec))

END FUNCTION