Using quotes in a AppleScript string

后端 未结 5 1134
时光取名叫无心
时光取名叫无心 2020-12-31 06:07

I am working with AppleScript and need to do this:

set TextToWrite to \" #!/bin/bash cd \"$( dirname \"$0\" )\" java -server -Xmx4G -jar ./craftbukkit.jar\"          


        
相关标签:
5条回答
  • 2020-12-31 06:36

    The following syntax can also be used:

    set aString to "quoted"
    set myString2 to "This is a " & quoted form of aString & " text."
    
    0 讨论(0)
  • 2020-12-31 06:47

    quoted form of (dirname as POSIX path)

    0 讨论(0)
  • 2020-12-31 06:50

    To insert literal quotes into an Applescript string, you have to escape them, i.e.

    set myString to "This is a \"quoted\" text."
    

    AppleScript has the same convention as most languages, which is to use a backslash for escaping of special characters, of which there are only two: quotes and … backslash. See the section “Special string characters” of the AppleScript Language Guide.

    0 讨论(0)
  • 2020-12-31 06:55

    Using quotes in applescript is quite easy you just need to make the line end and start in quotes

    E.G

    display dialog "hello world"

    but when you decide to put a variable in the text you must use &

    set my_name to "michael"

    display dialog "hello" & my_name

    thankyou

    0 讨论(0)
  • 2020-12-31 06:56
    set x to "He said   \" Enter the matrix.\"   "display dialog x
    

    Just copy this into applescript the easiest way to understand.

    0 讨论(0)
提交回复
热议问题