|
*** Two ways to get the Windows folder path
// The WSH way
? new OleAutoClient("Scripting.FileSystemObject").GetSpecialFolder(0).path
// The API way
? getWinPath()
function getWinPath
nlen=260;s=space(nlen)
If Type("WinAPIGetWindowsDirectory") # "FP"
extern CWORD WinAPIGetWindowsDirectory (CSTRING, CWORD) ;
KERNEL32 from "GetWindowsDirectoryA"
endif
nlen = WinAPIGetWindowsDirectory(s,nlen)
return left(s,nlen)
*** Two ways to get the Windows System Folder path
// The WSH way
? new OleAutoClient("Scripting.FileSystemObject").GetSpecialFolder(1).path
// The API way
? getWinSysPath()
function getWinSysPath
nlen=260;s=space(nlen)
If Type("WinAPIGetSystemDirectory") # "FP"
extern CWORD WinAPIGetSystemDirectory (CSTRING, CWORD) ;
KERNEL32 from "GetSystemDirectoryA"
endif
nlen = WinAPIGetSystemDirectory(s,nlen)
return left(s,nlen)
*** Five ways to get the Windows Temp folder path
? getEnv("Temp")
? left(funique(),rat("\",funique())-1)
Or since funique() always returns a 8-character file name
? left(funique(),len(funique())-9)
? fUnique().left(fUnique().lastIndexOf("\")) // same as
above only more OOP like
? fUnique().left(fUnique().length-9) // making use of the known
length
// The WSH way
? new OleAutoClient("Scripting.FileSystemObject").GetSpecialFolder(2).path
// Windows API way
? getTempPath()
function getTempPath
nlen=260;s=space(nlen)
if type("WinAPIGetTempPath") # "FP"
extern culong WinAPIGetTempPath(culong, cstring) KERNEL32 ;
from "GetTempPathA"
endif
nlen = WinAPIGetTempPath(nLen,s)
return left(s,nlen)
*** Two ways to get a Unique Temp file name
? fUnique() // see the OH, defaults to "temp" path if
no file spec
? new OleAutoClient("Scripting.FileSystemObject").getTempName()
|