Notifications
Clear all

[Closed] Open windows Folder?

I’ve wrote a short script the creates a folder structure, my question is, is it possible have a max script open a windows folder to show the user the folders have been sucessfully created?

Thanks

3 Replies

use:
shellLaunch “c:\”

hOpe this helps,
o

Thanks very much!

I did find that i needed to use:

shellLaunch “c:\” “”

for it to work.

thanks again for the speedy reply

There are a few ways you can determine if a directory was made or exists without requiring user intervention.

MakeDir() returns true if the directory was successfully created or false if the creation failed for any reason. It’s always a good idea to check the return value of MakeDir so you don’t try performing file I/O in a nonexistent folder


if MakeDir "c:/foo" == true then
(
-- do other file I/O stuff

)
else
(
-- better tell the user something bad happened.

)

You can use getDirectories() to get an array of directories that match the wildcard directory name given. Searching against that array for a specific name will tell you whether or not the directory exists


bDirectoryFound = false
DirectoryArray = getDirectories "c:\\*"
for DirName in DirectoryArray do


(-- if DirName == "c:\\foo" then bDirectoryFound = true)

if bDirectoryFound then
(
-- do file I/O stuff)else
(
-- No directory. Better not do file I/O.

)

You can even use getFiles() to determine if a directory exists. This method is only valid if there are files in the directory you are looking for, though. GetFiles() returns an array, so if that array’s .count property is > 0 then there are files in the folder, thus the folder exists.


if (getFiles "c:\\foo\\*.*").count > 0 then
(
-- do file I/O stuff

)
else
(
-- no directory, don't try to do file I/O

)