cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
tarrild
Level II

How to create a new directory/folder

Hi

When i run my JMP script it generates a lot of different graph that I save as PNG pictures. I would like JMP to each time I run the script to create a folder named with the date and time that the script is run and save the PNG files in that folder. I have looked around, but could not find anybody doing this from JMP script. Can it be done? If not, is there a workaround?

Best Regards

Tarrild

1 ACCEPTED SOLUTION

Accepted Solutions
jschroedl
Staff

How to create a new directory/folder

This is working for me in JMP 9 on Windows.

baseDir = "C:\temp\";
dir = baseDir || Substitute(MDYHMS(Today()), "/", "-", ":", ".");

CreateDirectory(dir);

John

View solution in original post

3 REPLIES 3
jschroedl
Staff

How to create a new directory/folder

This is working for me in JMP 9 on Windows.

baseDir = "C:\temp\";
dir = baseDir || Substitute(MDYHMS(Today()), "/", "-", ":", ".");

CreateDirectory(dir);

John

tarrild
Level II

How to create a new directory/folder

Brilliant !!!! Just what I needed

jschroedl
Staff

How to create a new directory/folder

Great!  I'll also add a method for JMP 8 users:

kernel32 = LoadDLL("kernel32");
kernel32 << DeclareFunction( "CreateDirectoryW",
          Convention( STDCALL ),
          Alias( "CreateDirectory" ),
          Arg( UnicodeString(260), "Path"),     // The directory to create
          Arg( IntPtr, ""),               // Security descriptor. 0 = default
          Returns( int32 )
);

baseDir = "C:\temp\";
dir = baseDir || Substitute(MDYHMS(Today()), "/", "-", ":", ".");

kernel32 << CreateDirectory(dir,0);

Recommended Articles