cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Overwriting existing JMP files

hi,

 

This may be a silly question, but I can't seem to solve it. I have a window scheduler that runs a JMP script every 12 hours, and saves the data table in a shared folder. However, the file cannot be saved in the next auto run, if the table is open (by any user), which it usually is. Is there a simple option to open JMP file in "read-only" mode and enable over-writing the data?

 

Thanks!

2 REPLIES 2
jthi
Super User

Re: Overwriting existing JMP files

To my knowledge there isn't "simple" option, but there are options, below are few:

  1.  Make the folder read-only for other users and give the write access to person who writes the file
  2. Use Run Command to enable writing "read-only" files. There are multiple ways to do this, but one would be to remove read-only flag just before overwriting and then enabling it after saving. If I remember correctly there are also force type flags, which can force overwrite read-only files.
-Jarmo
Craige_Hales
Super User

Re: Overwriting existing JMP files

Something like this might work. The DOS attrib command won't understand $desktop, so the second example uses convertFilePath to fix it up. It is also adding quotation marks in case you have spaces in your paths.

 

// make read only: attrib.exe +R <Path>
txt = Run Program(executable("attrib.exe"), options({"+R","\!""||FILENAME||"\!""}), readfunction("text"));

 

 

// make NOT read only: attrib.exe -R <Path>
txt = Run Program(executable("attrib.exe"),options({"-R","\!""||convertfilepath( FILENAME ,windows)||"\!""}),readfunction("text"));

The FileSnapper add-in uses this to make the snapshot files read only. I think it will work for .JMP tables too.

 

 

All of this assumes your users are on your team and not trying to break this solution. If they have r/w access to the file, they can change the attribute too. Then you'd need a server where you have write permission and they do not. If your shared folder is on your machine, you can probably set the permissions easier than using the attrib command. The permissions won't protect you from yourself--if you leave an instance of JMP running with the file open (not read only), the scheduled instance of JMP on the same machine/user will not have exclusive access. You might do both if it is critical.

Craige