C:\WinDev 19\Examples\Training\WD Text Files\Exe
// Displays the current directory
Info("Current directory: "+fCurrentDir())
EDT_CURRENTDIR = fCurrentDir()
// Create the TEMPTEST directory
IF fDirectoryExist(gsDir1) = False THEN
// Directory not found
IF NOT fMakeDir(gsDir1) THEN
Error(StringBuild("Error dreating directory %1",gsDir1))
ELSE
Info(StringBuild("%1 directory successfully created",gsDir1))
DIR_DEL..State = Active
END
ELSE
// Directory found
Error(StringBuild("%1 directory already found",gsDir1))
DIR_DEL..State = Active
END
IF YesNo("Do you want to delete this directory?") = 1 THEN
// Confirm
IF fDirectoryExist(gsDir1) = False THEN
// Directory not found
Error(StringBuild("Directory %1 not found", gsDir1),...
ELSE
// Directory found
IF fRemoveDir(gsDir1) = 0 THEN
// Deletion failed
Error(StringBuild("Error deleting the %1 directory",gsDir1),...
"Several reasons possible:",...
"The directory to delete is not empty or",...
"The directory to delete is the current directory")
ELSE
// Deletion OK
Info(StringBuild("%1 directory successfully deleted", gsDir1))
END
END
END
Selecionar Diretorio
sRes is string = "" // Name of the selected directory
// Using the Windows directory picker
sRes = fSelectDir(CompleteDir(EDT_CURRENTDIR), "Select a directory...", "")
// Has the user validated the directory selection
IF sRes <> "" THEN
// A directory was selected by the user
Info(StringBuild("The directory selected is %1", sRes))
ELSE
// No directory was selected by the user
Info("No selected directory")
END
DirName is string = "c:\temp" // Name of the directory whose existence is checked
// Check the existence of the directory
IF fDirectoryExist(DirName) = False THEN
// The directory does not exist
Info(StringBuild("%1 directory not found", DirName))
ELSE
// The directory exists
Info(StringBuild("Directory %1 exists", DirName))
END
Nenhum comentário:
Postar um comentário