Thanks. Option A works (and is all I need), but option does not work.
NB. Option A had syntax error Out instead of out, but works.
NB. Option B did not work.
load 'plot'
NB. option A
pd_show_jzplot_=: 3 : 0
ndx=. ({."1 PCmd) i. <'output'
if. ndx < #PCmd do.
OUTPUT=: 1 pick ndx{PCmd
end.
NB. out=. deb tolower OUTPUT
out=. deb OUTPUT NB. new
ndx=. out i. ' '
NB. fn=. 'pd_', ndx {. out
NB. fn=. 'pd_',tolower ndx {. Out NB. new
fn=. 'pd_',tolower ndx {. out NB. new NB. syntax error Out
arg=. (ndx+1) }. out
fn~arg
EMPTY
)
'output pdf /tmp/Capital/test.pdf' plot i.10 NB. works
'output pdf /tmp/capital/test.pdf' plot i.10 NB. works
'output pdf "/tmp/capital/test space.pdf"' plot i.10 NB. works
'output pdf "/tmp/Capital/test space.pdf"' plot i.10 NB. works
NB. Option B
pd_show_jzplot_=: 3 : 0
ndx=. ({."1 PCmd) i. <'output'
if. ndx < #PCmd do.
OUTPUT=: 1 pick ndx{PCmd
end.
out=. dlb OUTPUT
fn=. 'pd_', tolower ' ' taketo out
arg=. ' ' takeafter out
fn~arg
EMPTY
)
NB. Fix to qchop prevents deletion of extraneous blanks inside
double-quoted strings.
NB. Handles multiple consecutive spaces in dquoted strings
qchop_jzplot_=: 3 : 0
q=. dquoted y
s=. ' '=y
qs=. q*.s
y=. DEL (inxb qs)}y
NB. deb each unquot each ((DEL,' ')&charsub) each chop y
unquot each ((DEL,' ')&charsub) each deb each chop y NB. new
)
'output pdf /tmp/Capital/test.pdf' plot i.10 NB. works
'output pdf /tmp/capital/test.pdf' plot i.10 NB. works
'output pdf "/tmp/capital/test space.pdf"' plot i.10
NB. fails with pop-up window:
NB.Unable to write file: /tmp/capital/test space.pdf
NB.The file name is invalid.
'output pdf "/tmp/Capital/test space.pdf"' plot i.10
NB. fails with pop-up window:
NB.Unable to write file: /tmp/Capital/test space.pdf
NB.The file name is invalid.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm