On Windows, the Get Name() message to a data table returns only the table name, without the ".jmp" appended.
Names Default To Here( 1 );
dt = Open( "$DESKTOP/Big Class.jmp" );
Show( dt << get name() );
Log:
//:*/
Names Default To Here( 1 );
dt = Open( "$DESKTOP/Big Class.jmp" );
Show( dt << get name() );
/*:
dt << get name() = "Big Class";
So, you'll need to append the ".png" to get a complete filename for New Image().
Here's an example using Big Class (copied to your desktop) and the attached Big Class.png file here.
Names Default To Here( 1 );
dt = Open( "$DESKTOP/Big Class.jmp" );
gb = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) ),
SendToReport( Dispatch( {}, "Graph Builder", FrameBox, {Transparency( 0.5 )} ) )
);
frame = (gb << report)[FrameBox( 1 )];
n = dt << Get Name();
img = New Image( "$DESKTOP/" || n || ".png" );
frame << Add Image(
image( img ),
Bounds(
Left( 61.2587412587413 ),
Right( 179.370629370629 ),
Top( 70.8292080975384 ),
Bottom( 48.5033161162993 )
),
SetSize( {799, 620} )
);
NB: On the Mac, <<Get Name() returns the whole filename, including the .jmp. Therefore, on the Mac you'll need to use Substitute Into() to replace the ".jmp" with ".png".
Names Default To Here( 1 );
dt = Open( "~/Desktop/Big Class.jmp" );
gb = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) ),
SendToReport( Dispatch( {}, "Graph Builder", FrameBox, {Transparency( 0.5 )} ) )
);
frame = (gb << report)[FrameBox( 1 )];
n = dt << Get Name();
Substitute Into( n, ".jmp", ".png" );
img = New Image( "~/Desktop/" || n );
//img<<Rotate(270);
frame << Add Image(
image( img ),
Bounds( Left( 61.2587412587413 ), Right( 179.370629370629 ), Top( 70.8292080975384 ), Bottom( 48.5033161162993 ) ),
SetSize( {799, 620} )
);
-Jeff