Hi all,
Doing some testing on a technical upgrade from 3.60 to 2009, have found one bit of code that doesn't work. On several forms I've added a button to open a folder from a directory on the server (or create it if it doesn't exist), the code came from these forums although I've tweaked it a bit:
FolderName := "No.";
IF ISCLEAR(FileSystem) THEN
CREATE(FileSystem);
// If the folder exists, open it
IF FileSystem.FolderExists('\\rocdc01\sales\ac_files\'+FolderName) THEN
SHELL('c:\windows\explorer.exe \\rocdc01\sales\ac_files\'+FolderName);
// If the folder doesn't exist, ask if you want to create it then open the folder
IF NOT FileSystem.FolderExists('\\rocdc01\sales\ac_files\'+FolderName) THEN
IF NOT CONFIRM('The folder does not exist. Do you want to create it?') THEN
EXIT
ELSE
FileSystem.CreateFolder('\\rocdc01\sales\ac_files\'+FolderName);
SHELL('c:\windows\explorer.exe \\rocdc01\sales\ac_files\'+FolderName);
The globals are:
FileSystem / Automation / 'Microsoft Scripting Runtime'.FileSystemObject
FolderName / Text / 50
The only bit that doesn't work is the part where it opens the folder, each time it tries the system displays the following error:
The operating system cannot find the drive and directory that are specified for the file "c:\windows\explorer.exe \\rocdc01\sales\ac_files\AC07694" .
Verify that the drive, directory, and file names are correct.
Any help appreciated!
Comments
you can try to use
//WshShell Automation 'Windows Script Host Object Model'.WshShell
//Myfolder text --> path of your folder
Envir :='%windir%\explorer.exe';
WshShell.Exec(Envir+MyFolder);