大家好
在回顾了一些关于 XPATH 函数的讨论并使用了 JMP JSL 帮助后,下面的脚本出现了。
想要将此脚本作为 PNG 文件从变异图表复制到桌面文件夹。
这在编写包含多个图表的报告时非常有用。
这个在其他平台上工作的主要和关键参数是用于划分“xpath”函数和 outlinebox 函数对应的 f(i) 函数的数字。
在这种情况下,xpath 分隔符 = 2。
f(i) = 2*i-1。
//-------------------------
Clear Log();
Names Default To Here( 1 );
while( 1,
If( Is Directory( "$DESKTOP/Graph" ) == 0,
//if no directory -> create folder and display Message
rc = Create Directory( "$DESKTOP/Graph" );
//copy graphs
for( i = 1, i <= N Items( Current Report() << XPath( "//OutlineBox" ) ) / 2, i++,
Current Report()[Outline Box( 2 * i - 1 )] << Save Picture(
"$DESKTOP/Graph/Graph" || Char( i ) || ".PNG", "PNG"
);
Wait( 0.001 );
);
//display Message
New Window( "Message",
modal,
H List Box(
Spacer Box( size( 5, 0 ) ),
Text Box( "All graphs are saved at new folder at Desktop/Graph" )
)
);
//if there is directory -> check if empty if no break if yes continue
,
if( N Items( Files In Directory( "$DESKTOP/Graph" ) ) > 0,
New Window( "Message",
modal,
H List Box( Spacer Box( size( 5, 0 ) ), Text Box( "Please empty folder DESKTOP/Graph" ) )
);
Break();
,
//copy graphs
for( i = 1, i <= N Items( Current Report() << XPath( "//OutlineBox" ) ) / 2, i++,
Current Report()[Outline Box( 2 * i - 1 )] << Save Picture(
"$DESKTOP/Graph/Graph" || Char( i ) || ".PNG", "PNG"
);
Wait( 0.001 );
);
//display Message
New Window( "Message",
modal,
H List Box(
Spacer Box( size( 5, 0 ) ),
Text Box( "All graphs are saved at new folder at Desktop/Graph" )
)
);
)
);
Break();
);
//-------------------------