2800 Views 2 Replies Latest reply: Jun 18, 2010 12:02 AM by taylor.henderson
This is a common issue.
Both the shell and AppleScript use the backslash to escape characters - in the shell's case it tells the shell to pass the next character as-is.
The issue you're running into is that AppleScript is jumping in and seeing the slash, which it also interprets as 'pass the next character as-is', so it strips the slash and passes the ampersand to the shell which, of course, treats it as it normally would since it is no longer escaped.
The solution is simple, though - double-escape the ampersand. The first slash will be interpreted by AppleScript to tell it to pass the next character (the second slash) to the shell. The shell then sees a single backslash which it interprets as an escape of the ampersand. Voila!
do shell script "open -a Firefox http://www.aSite.org/data.php?email=myName88%40live.com&#92;&#92;&passwd =myPass"
(Note that if Firefox is your default web browser you can just use the simpler form:
open location "http://www.aSite.org/data.php?email=myName88%40live.com&passwd=myPass"
which avoids the whole escaping issue altogether.)
Message was edited by: Camelot