cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Saving PNG to created directory

I would like to save "pngs" into my created directory. When I run the script the directory folder is made but the PNGs aren't saved because I'm not sure how to word the pathing. What syntax should I use?

baseDir = "C:\temp\";
dir = baseDir || Substitute(MDYHMS(Today()), "/", "-", ":", ".");

CreateDirectory(dir);

gb=Graph Builder(
	Size( 876, 598 ),
	Show Control Panel( 0 ),
	Variables(
		X( :site ),
		Y( :VBD ),
		Group X( :wfr, Size( 57 ) ),
		Group Y( :size ),
		Color( :size )
	),
	Elements( Points( X, Y, Legend( 22 ) ) ),
	Local Data Filter(
		Close Outline( 1 ),
		Add Filter(
			columns( :size, :metal ),
			Where( :size == {"861.0x0.18", "863.5x0.18", "1014.0x0.144"} ),
			Where( :metal == {"M1", "M2", "M3"} ),
			Display( :size, N Items( 6 ) )
		)
	),
	SendToReport(
		Dispatch( {}, "", ScaleBox,
			{Min( -0.119090909090909 ), Max( 5.12090909090909 ), Inc( 1 ),
			Minor Ticks( 1 )}
		),
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				22,
				Level Name( 0, "Metal 2- 861.0x0.18", Item ID( "861.0x0.18", 1 ) ),
				Level Name( 1, "Metal 3- 863.5x0.18", Item ID( "863.5x0.18", 1 ) ),
				Level Name(
					2,
					"Metal 1- 1014.0x0.144",
					Item ID( "1014.0x0.144", 1 )
				)
			)}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "Vbd - Narrow" )} ),
		Dispatch( {}, "X title", TextEditBox, {Set Text( "Site" )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "Volts" )} ),
		Dispatch( {}, "400", LegendBox, {Set Title( "Metals" )} )
	)
);
	
	report(gb)<<save picture( dir || "Vbd-Wide.png", "png" );
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Saving PNG to created directory

The path you are specifying is incorrect.

"C:\temp\12-12-2024 12.04.31 PMVbd-Wide.png"

It contains blanks and there is not a "\" between the directory path and the file name

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Saving PNG to created directory

The path you are specifying is incorrect.

"C:\temp\12-12-2024 12.04.31 PMVbd-Wide.png"

It contains blanks and there is not a "\" between the directory path and the file name

Jim

Re: Saving PNG to created directory

Thank you!

 

I also found a different solution by replacing last line with this:

filePath = dir || "\Vbd-Wide.png";
gb << Save Picture(filePath, "png");

 

Recommended Articles