My Action is creating a multi-line title

I put a lot of work into creating this action and it works well, but for some reason when I use AppleScript to create the new draft it makes the draft title multi-line, about 30 lines, even though I put the title in the first line.

Has anyone else had this issue?

Try amending your prompt to tell the GPT to explicitly put a newline at the end of the title.

What you describe sounds like it is just treating it like a sentence rather than a separate line so either you need to code the split or instruct the GPT to include it.

If this does not sound right maybe you could post a sanitised example of the top of the draft so we can see first hand the nature of the issue?

Yeah, sorry for not providing more details initially. It was a late night of frustration.

Here’s a screenshot of the final Draft with a fake email. “Photographer Spotlight” is the title GPT suggested and is formatted correctly as a single line. However, when you view the list of drafts on the left, that one draft occupies the entire screen because most of the draft is interpreted as a headline in Drafts.

It is done with this ActionScript

tell application "Drafts"
    set fullContent to jsonResult & return & return & "------------------" & return & threadContent
    make new draft with properties {content:fullContent, flagged:false, tags:{"commercial job"}}
end tell

This code block does the following:

  1. It tells the AppleScript to interact with the Drafts application.
  2. It creates a variable called fullContent that combines the jsonResult (which contains the extracted and formatted information from the email thread) with the original threadContent, separated by a line of dashes.
  3. It then uses the make new draft command to create a new draft in Drafts with the following properties:
  • The content is set to the fullContent variable
  • The flagged property is set to false
  • The tags property is set to include one tag: “commercial job”

In your AppleScript, you are using return, which only inserts a carriage return (\r) character. You want linefeed, which inserts a new line (\n) unix-style line feed.

Try:

tell application "Drafts"
    set fullContent to jsonResult & linefeed & linefeed & "------------------" & linefeed & threadContent
    make new draft with properties {content:fullContent, flagged:false, tags:{"commercial job"}}
end tell

If you care to read one, here’s a more detailed discussion of this difference

Ahhhh, Thanks a lot, with some adjusted code that fixes my problem!