cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Hegedus
Level IV

set default directory

In the script I am writing, I ask the user for a file to import (an Excel file).

I then create a folder at the same level as the imported file to store all the analysis in on spot.

The script basically does

if(directory exists(saveDirectory),

  ,

  create directory(saveDirectory)

);

set default directory(saveDirectory);


The rest of the script saves png files as analysis results.  (Please make the PowerPoint output usable, but that is another issue).


This works fine on my Mac but does not work with users running Windows.


The directory is created, but the set default directory is not respected.  It is uses the JMP folder in the program files.


I am on JMP 12 and the users are on JMP 11.


Is this a known bug or do I need to do something different for the Windows version?


Andy



1 ACCEPTED SOLUTION

Accepted Solutions
msharp
Super User (Alumni)

Re: set default directory

Yeah it definitely feels like a bug.  You can submit a case to support@jmp.com and see what they say.

View solution in original post

5 REPLIES 5
msharp
Super User (Alumni)

Re: set default directory

Using both JMP 11 and JMP 12 I don't have issues on windows.  One thing to know while debugging, if I run the below script as one it runs fine.  But if I try to run Part 1 THEN Part 2 there is an IO error.  Setting the default directory seems to be a private variable since it doesn't stick.

    //Part 1

    saveDirectory = "C:\TEMP";

    if(directory exists(saveDirectory),

      ,

      create directory(saveDirectory)

    );

    set default directory(saveDirectory);

    text = "test";

    //Part 2

    save text file("test.txt", text);

    open("test.txt");

I'm not sure why it isn't working, but as a work around you can always do a simple two step modification:

     filepath = saveDirectory || "example.png";

     pic_obj << Save Picture( filepath, "png" );

I would also worry about write permissions if they are trying to save a secure directory, but that doesn't seem to be an issue since as you say, the directory is created.

Hegedus
Level IV

Re: set default directory

I am seeing similar things.

I am doing exactly what you do in Part 2.  This works fine on a Mac and also gives me the error on Windows.

Set Default Directory(saveDirectory) as private variable certainly does not seem the intent.  Why would I be able to set some thing I can use?

I am also doing the work around, but I shouldn't have to?

msharp
Super User (Alumni)

Re: set default directory

Yeah it definitely feels like a bug.  You can submit a case to support@jmp.com and see what they say.

Re: set default directory

A track was entered for this request. As a result, the behavior was reported to Development. The response to this report was the following: 

 

In its current implementation, Set Default Directory() lasts only for the
current JSL execution. The default directory needs to get reset to the current JSL file's
directory for relative paths to work.

SW
SW
Level II

Re: set default directory

I'm having the same issue.  Is there a workaround?

 

I'd like to run a script where the user navigates and selects a data table to open.

After the script is complete, the user may immediately run the script a second time, and I'd like to default to the last directory they selected.

 

Thanks.