作成したディレクトリに「png」を保存したいと思います。スクリプトを実行するとディレクトリ フォルダーは作成されますが、パスの指定方法がわからないため PNG は保存されません。どのような構文を使用すればよいですか?
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=""></SAVE>指定したパスが正しくありません。
"C:\temp\12-12-2024 12.04.31 PMVbd-Wide.png"
空白が含まれており、ディレクトリパスとファイル名の間に「\」がありません
ありがとう!
最後の行を次のように置き換えることで、別の解決策も見つかりました。
filePath = dir || "\Vbd-Wide.png";
gb << Save Picture(filePath, "png");