cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

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

no save file

Hello everyone, my problem is that when I press the button "Annuler" (=Cancel), it still saves the file to me even though I don't want it, how can I do that?
I put you the attached script.
Thanks

 

NetflixCrow956_0-1648643389055.png

path_save = Pick Directory( "Où sauver les fichiers analyse rendement?" );

NAME = "_ANALYSE_RENDEMENT";
//////////////////////////////////////        DEFINE DIR AND FILE NAMES (MONTH / YEAR) + CREATE DIR              /////////////////////////////////////////////////////////
DAY_   = Day(Today());
MONTH_ = Month( Today() );
YEAR_ = Year( Today() );
HOUR_ = Hour(Today());
MINUTE_ = Minute(Today());
SECONDE_ = Second(Today());


If(MONTH_ < 10 , NAME_MONTH= "0" || Char(MONTH_), NAME_MONTH= Char(MONTH_) );
If(DAY_   < 10 , NAME_DAY= "0"   || Char(DAY_)  , NAME_DAY  = Char(DAY_)   );
NAME_TIME = "_" || Char(HOUR_) || "H" || Char(MINUTE_) || "M" || Char(SECONDE_) || "S";

//DIR_NAME = Char(MONTH_ )|| " - " || Word(1,NAME,"_") || "_" || Char( YEAR_ ) ;
DIR_NAME = Char( YEAR_ ) || NAME_MONTH || NAME_DAY || NAME_TIME || NAME;

If( Directory Exists( path_save || DIR_NAME ), ,	Create Directory( path_save || DIR_NAME ));

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: no save file

Adding check for empty path might be enough:

Names Default To Here(1);

path_save = Pick Directory( "Où sauver les fichiers analyse rendement?" );

If(path_save == "",
	Show("Cancel pressed");
	stop(); //or use throw()
);

NAME = "_ANALYSE_RENDEMENT";
//////////////////////////////////////        DEFINE DIR AND FILE NAMES (MONTH / YEAR) + CREATE DIR              /////////////////////////////////////////////////////////
DAY_   = Day(Today());
MONTH_ = Month( Today() );
YEAR_ = Year( Today() );
HOUR_ = Hour(Today());
MINUTE_ = Minute(Today());
SECONDE_ = Second(Today());


If(MONTH_ < 10 , NAME_MONTH= "0" || Char(MONTH_), NAME_MONTH= Char(MONTH_) );
If(DAY_   < 10 , NAME_DAY= "0"   || Char(DAY_)  , NAME_DAY  = Char(DAY_)   );
NAME_TIME = "_" || Char(HOUR_) || "H" || Char(MINUTE_) || "M" || Char(SECONDE_) || "S";

//DIR_NAME = Char(MONTH_ )|| " - " || Word(1,NAME,"_") || "_" || Char( YEAR_ ) ;
DIR_NAME = Char( YEAR_ ) || NAME_MONTH || NAME_DAY || NAME_TIME || NAME;

If( Directory Exists( path_save || DIR_NAME ), ,	Create Directory( path_save || DIR_NAME ));
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: no save file

Adding check for empty path might be enough:

Names Default To Here(1);

path_save = Pick Directory( "Où sauver les fichiers analyse rendement?" );

If(path_save == "",
	Show("Cancel pressed");
	stop(); //or use throw()
);

NAME = "_ANALYSE_RENDEMENT";
//////////////////////////////////////        DEFINE DIR AND FILE NAMES (MONTH / YEAR) + CREATE DIR              /////////////////////////////////////////////////////////
DAY_   = Day(Today());
MONTH_ = Month( Today() );
YEAR_ = Year( Today() );
HOUR_ = Hour(Today());
MINUTE_ = Minute(Today());
SECONDE_ = Second(Today());


If(MONTH_ < 10 , NAME_MONTH= "0" || Char(MONTH_), NAME_MONTH= Char(MONTH_) );
If(DAY_   < 10 , NAME_DAY= "0"   || Char(DAY_)  , NAME_DAY  = Char(DAY_)   );
NAME_TIME = "_" || Char(HOUR_) || "H" || Char(MINUTE_) || "M" || Char(SECONDE_) || "S";

//DIR_NAME = Char(MONTH_ )|| " - " || Word(1,NAME,"_") || "_" || Char( YEAR_ ) ;
DIR_NAME = Char( YEAR_ ) || NAME_MONTH || NAME_DAY || NAME_TIME || NAME;

If( Directory Exists( path_save || DIR_NAME ), ,	Create Directory( path_save || DIR_NAME ));
-Jarmo

Recommended Articles