Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'problem with filename spaces' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
problem with filename spaces
Authored by: tomem on Nov 16, '02 05:05:15PM

Great tip. I really miss being able to drop files on desktop printers, too.

One problem is the "POSIX path" does not pick up spaces in filenames properly, i.e. with a backslash in front of them. Therefore this doesn't work for filenames with spaces, for example the screen shot files that the OS X generates, of the form "Picture N.pdf". By the time you've played around fixing the filename, you might as well have opened up Preview and printed...

But it's fine for "well-behaved" unix filenames...



[ Reply to This | # ]
problem with filename spaces
Authored by: googoo on Nov 19, '02 01:11:24PM

I think you can get around the space-in-filename problem by inserting a quote in the UNIX (shell script) command generated by the AppleScript. Do this by changing the first do shell script line to

do shell script "/usr/bin/lp " & "'" & thePath & "'"

Note that there is a single quote inside a pair of double quotes on either side of & thePath &.You would have to simillarly modify the second command. I will test this and see if it works.

-Mark



[ Reply to This | # ]
problem with filename spaces
Authored by: googoo on Nov 19, '02 01:39:33PM

The solution that I proposed above works. The quotes around the file path ensure that spaces are treated as characters rather than as seperators between different file names.

Thanks for pointing out this problem with my script. I have very few file names with spaces and did not notice it.

-Mark

P.S. I am correcting the script that I posted to include this improvement.



[ Reply to This | # ]