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
hardner
Level V

JMP16 Save Image now needs image type in quotes

Appears that the image type argument in Save Image() now has to be in quotes.

The scripting index does not reflect this and its example code does not work in version 16.

 

In the sample code, the Open() works with jpg as an argument,  but the Save Image() says "name unresolved jpg in access or evaluation of 'jpg':

 

img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
obj = New Window( "tile(40,40)", img );
img << Save Image("C:/temp/Mediterranean.jpg", jpg);

 

Putting jpg (or other file types) in quotes does work - it doesn't just not fail but will save in the type requested.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: JMP16 Save Image now needs image type in quotes

Thanks for pointing this out, @hardner and @Craige_Hales.

 

The change in behavior for the image type argument for Save Image() was recently reported.  We do expect that the Scripting Index (Help > Scripting Index) will be updated to demonstrate the requirement for double-quoting of the image type argument.

 

With regard to the overall confusion, Craige's explanation is correct.  It is a work in progress.  Feel free to report any inconsistencies you encounter in the future to JMP Technical Support, support@jmp.com.

Wendy

View solution in original post

5 REPLIES 5
Georg
Level VII

Re: JMP16 Save Image now needs image type in quotes

Thanks for posting this finding, I think you should report it to: support@jmp.com

Georg
Craige_Hales
Super User

Re: JMP16 Save Image now needs image type in quotes

JMP is correcting some implementation details. No idea if this correction was intentional or a side effect. The problem with the unquoted name is that you can't make it a variable. Imagine writing your own save dialog, where the dialog allows selecting the save-as type. You'd have to keep N separate calls to the save function, and an if statement to select one of the calls. With a variable set to the save-as type, it is cleaner.

In general, if JMP will accept a quoted string or an unquoted name, you'll want to use the quoted string. It looks a little uglier, unless you think about the flexibility it implies.

Craige
hardner
Level V

Re: JMP16 Save Image now needs image type in quotes

Thanks!  I do understand and appreciate the motivation. I don't have to imagine wanting to have options be variables.

 

But the "transition" seems confusing.   Quite a few cases have been producing "Unquoted JSL name processed as a literal" warnings in earlier versions and I've been diligently eliminating those from my fairly extensive JSL code base.  With a lot of code to maintain it was very helpful to have warnings of what to change.    But this SaveImage() example does not give a warning in 15.

 

Meanwhile other things that did give a warning (and I have duly changed!) still work in 16. 

(when I first found this Save Image issue I thought maybe all those warnings were now enforced rules in 16, but no)

 

An example of that is this example code (from the Scripting Index) for caption:

Names Default To Here( 1 );
Caption(
	{100, 200},
	"explanation",
	Font( "Arial Black" ),
	Font Size( 16 ),
	Text Color( "blue" ),
	Back Color( "yellow" ),
	Spoken( 1 )
);

In 15 you get a warning if you don't have quotes around blue and yellow but it still works in 16 (and no longer gives a warning!).

 

Anyway, just noting it's confusing when some cases fail and others don't, some trigger warnings and others don't, code that JMP itself provided via the red arrow--> save script in the past used this disfavored method and some of the documentation still shows it as examples.

 

I'm on the alert now that I might have missed other 15/16 incompatibilities around this despite having done testing and  I'll be trying to proactively find places to add quotes.

 

Craige_Hales
Super User

Re: JMP16 Save Image now needs image type in quotes

@Wendy_Murphrey 

Craige

Re: JMP16 Save Image now needs image type in quotes

Thanks for pointing this out, @hardner and @Craige_Hales.

 

The change in behavior for the image type argument for Save Image() was recently reported.  We do expect that the Scripting Index (Help > Scripting Index) will be updated to demonstrate the requirement for double-quoting of the image type argument.

 

With regard to the overall confusion, Craige's explanation is correct.  It is a work in progress.  Feel free to report any inconsistencies you encounter in the future to JMP Technical Support, support@jmp.com.

Wendy