Subscribe Bookmark RSS Feed

set default directory

Hegedus

Community Trekker

Joined:

Jun 23, 2011

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



3 REPLIES
msharp

Super User

Joined:

Jul 28, 2015

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

Community Trekker

Joined:

Jun 23, 2011

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

Joined:

Jul 28, 2015

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