This snippet works for me. It assumes that your text has been copied to the clipboard, but there must be other ways to pass that data along to Applescript. The code is in escaped format as required by Filemaker's "calculated applescript":
"tell application \"Finder\" " & "¶" & "set theText to the clipboard as Unicode text " & "¶" & " set AppleScript's text item delimiters to (RETURN)" & "¶" & " set myFile to the (path to current user folder as text) & \"Desktop:textfile.txt\" as text " & "¶" & " if exists file myFile then " & "¶" & " delete file myFile " & "¶" & " end if " & "¶" & " open for access file myFile with write permission " & "¶" & " set theFileRef to result " & "¶" & " write theText to theFileRef as string " & "¶" & " close access theFileRef " & "¶" & "end tell "
Jim Weisbin human 138 5th avenue. 3rd floor, nyc, ny 10011 telephone 212 352 0211 facsimile 212 352 0210
|