Re: The usage of PS_END [message #62781 is a reply to message #62780] |
Mon, 06 October 2008 16:02   |
jeffnettles4870
Messages: 111 Registered: October 2006
|
Senior Member |
|
|
On Oct 6, 6:56 pm, "Jeff N." <jeffnettles4...@gmail.com> wrote:
> On Oct 6, 5:22 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> dux...@gmail.com writes:
>>> I have found the reason that made PS_END not to covert PS file to
>>> another type file.
>>> Because my file path contains a space like 'C:\My Documents'.
>
>>> The string 'cmd' in PS_END is 'convert -density 300 D:\My Documents
>>> \lineplot.ps -resize 25% D:\My Documents\lineplot.png'
>>> When the command 'SPAWN, cmd' is executed, the windows system cannot
>>> identify 'My Documents' as a whole directory name.
>>> So the double quotation marks shouble be added for the filename with
>>> filepath.
>>> The cmd become 'convert -density 300 "D:\My Documents\lineplot.ps" -
>>> resize 25% "D:\My Documents\lineplot.png"'.
>
>>> Therefore, I change the line 187 in PS_START/PS_END into
>>> cmd =3D 'convert -density 300 ' + '"' + ps_struct.filename + '"' + ' -
>>> resize 25% ' + '"' + outfilename + '"'
>>> And now the command 'PS_END, /png' can create 'lineplot.png'
>>> successfully.
>
>>> But I want to konw how to call PS_START with the whole path filename,
>>> for example:
>>> ps_start,filename=3D'D:\plot.ps'
>
>> Humm. This is a good point. Spaces in file names gave
>> me so damn much grief when the Windows and first Mac
>> versions of IDL came out, that I have never--from that
>> day to this--EVER named a directory with a space in it
>> on any computer I ever owned. (The definition of an
>> indelible experience, I guess.)
>
>> ITTVIS has produced a function (IDL_VALIDNAME) to let
>> you know if a string is a valid variable name. Perhaps
>> someone can write a function that can fix filenames with
>> spaces inside them. (I have to leave it as an exercise
>> for the reader, as I am late for a meeting.)
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Coyote's Guide to IDL Programming (www.dfanning.com)
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> This gave me an issue with ps_start/ps_end also. You have to surround
> the path with quotes, but this turned out to not be as easy as I
> thought so what I did was use the ascii character for a quote:
>
> path = c:\documents and settings\blah\blah\blah'
> quote = string(34b)
> path = quote + path + quote
>
> That worked for me.
>
> Jeff
oops first line should be:
path = 'c:\documents and settings\blah\blah\blah'
Now that I think about it, i may even have had to quote the individual
directories, not the entire path string (so the path to pass to
convert.exe would be
c:\"documents and settings"\blah\blah\blah
and not
"c:\documents and settings\blah\blah\blah"
which of course means you have to split your string using '\' (or
path_sep()) as a delimeter, search all the extracted strings for
spaces and then put quotes around any that need them. Sigh. I hope i
didn't have to do all that, that doesn't sound fun :(
Jeff
|
|
|