1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

AppleScript - Escape not working?

Discussion in 'Mac Programming' started by idonotliketostu, Oct 15, 2009.

  1. macrumors 6502

    #1
    How do I get rid of the backslash in the results?
     

    Attached Files:

  2. macrumors 65816

    mysterytramp

    #2
    In the Result window, you can't. It's how AppleScript handles quotes internally. But the slashes won't appear in dialog boxes or in text output.

    mt
     
  3. macrumors 6502

    #3
    I though the results area is the text output area? which text output area are you referring to.
     
  4. macrumors 65816

    mysterytramp

    #4
    Files. You can run this test:

    Code:
    display dialog "Please input string (please use quotes):" default answer ""
    set textOutput to text returned of result
    set quotedText to textOutput -- check Events window and you'll see your string with slashes and quotes
    display dialog "Here's what you input, without slashes:" & return & quotedText
    display dialog "Now we'll save the string to a disk"
    set docAlias to path to documents folder
    set newFileName to (choose file name with prompt "Please enter a file name" default name "quote test" default location docAlias)
    set newFileNameString to newFileName as string
    set outPutfile to open for access file newFileNameString with write permission
    write quotedText to outPutfile starting at eof
    close access outPutfile
    display dialog "Now please check the quotes in your file."
    
    mt
     

Share This Page