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


Click here to return to the 'A real random fortune signature for Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A real random fortune signature for Mail.app
Authored by: cudaboy_71 on May 25, '04 04:53:02PM

looks like applescript...but, doesnt compile :(

error: A identifier can't go after this """. goes back to the script with the "cd highlighted.

---
if it aint broke, break it!



[ Reply to This | # ]
A real random fortune signature for Mail.app
Authored by: valx on May 25, '04 05:45:57PM

When using quotation marks in the do shell script command of applescript, you have to escape them with a \.

So it should be:

set fortune to do shell script "cd \"/Applications/Cocoa Fortune/Cocoa Fortune.app/Contents/MacOS\" ; ./fortune;"

[ Reply to This | # ]
A real random fortune signature for Mail.app
Authored by: valx on May 25, '04 05:50:01PM

Oops, have to escape them with

\
So your code will look like this:
set fortune to do shell script  "cd \"/Applications/Cocoa Fortune/Cocoa Fortune.app/Contents/MacOS\" ; ./fortune;"


[ Reply to This | # ]
A real random fortune signature for Mail.app
Authored by: greed on May 26, '04 10:26:59AM

And how about changing that ';' to an '&&', so if the CD fails (because the program is gone or something), the 'fortune' command isn't attempted? So you get:
cd somedir && ./command

And while we're at it, is it really necessary to do the 'cd' first? Just
somedir/command
works for all but the most badly-written of programs.



[ Reply to This | # ]
A real random fortune signature for Mail.app
Authored by: chmod007 on May 30, '04 11:58:12AM

As the developer of Cocoa Fortune, I do feel like I need to respond to that ;-). You did, after all, imply that my program was badly written.

The fortune binary used by Cocoa Fortune uses a relative path for the built-in fortunes. Therefore, it is necessary to set up the current directory properly (so that datfiles == ./datfiles). If you have a datfile directory in some other location, cd to that place first.

This was done in order to allow the user to move the application around without problems.

/ Regards, David Remahl



[ Reply to This | # ]