• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Do shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do shell script


  • Subject: Re: Do shell script
  • From: Graff <email@hidden>
  • Date: Wed, 25 Feb 2004 11:55:24 -0500

Let me get this straight, your actual path is "/Users/TripleZ/Desktop/Prog CSS/CSSEdit.app", right?

If so then your best bet is to quote it or escape it. If you want to escape the command directly then you will have to use two backslashes to escape a character such as a space. One backslash to escape the character in the shell and one more to get a literal backslash from AppleScript. You need two because the backslash is also an AppleScript text string escape character:

do shell script "open /Users/TripleZ/Desktop/Prog\\ CSS/CSSEdit.app"


Quoting is easier, but you should use single quotes if possible. If you use double quotes then you'll have to escape them with a backslash so they pass through AppleScript:

single quotes:
do shell script "open '/Users/TripleZ/Desktop/Prog CSS/CSSEdit.app'"

double quotes:
do shell script "open \"/Users/TripleZ/Desktop/Prog CSS/CSSEdit.app\""


AppleScript can do quoting automatically for you. Here is an example of how to do this:
---------------
set thePath to quoted form of "/Users/TripleZ/Desktop/Prog CSS/CSSEdit.app"
do shell script "open " & thePath
---------------

- Ken

On Feb 25, 2004, at 10:27 AM, Gianfranco wrote:

Maybe this is a stupid question but if I use the Do shell script command with spaces in the string the command didn't work

for example

do shell script "open /Users/TripleZ/Desktop/ProgCSS/CSSEdit.app"

the script works fine if I use

do shell script "open /Users/TripleZ/Desktop/Prog\ CSS/CSSEdit.app" like in Terminal
or
do shell script "open /Users/TripleZ/Desktop/Prog CSS/CSSEdit.app"

the script didn't work any solution?

Thanks in advance.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Do shell script (From: Gianfranco <email@hidden>)

  • Prev by Date: Re: New iTunes Track (AS DJ Script)
  • Next by Date: Re: How to make thumbnail
  • Previous by thread: Re: Do shell script
  • Next by thread: Re: Do shell script
  • Index(es):
    • Date
    • Thread