Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6940431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:45:06+00:00 2026-05-27T12:45:06+00:00

I am trying to modify an applescript that takes a text file, and creates

  • 0

I am trying to modify an applescript that takes a text file, and creates a new todo with each line of the text file:

set myFile to (choose file with prompt "Select a file to read:")
open for access myFile

set fileContents to read myFile using delimiter {linefeed}
close access myFile

tell application "Things"

    repeat with currentLine in reverse of fileContents

        set newToDo to make new to do ¬
            with properties {name:currentLine} ¬
            at beginning of list "Next"
        -- perform some other operations using newToDo

    end repeat

end tell

I would like instead, to be able to simply use the clipboard as the data source instead so I don’t have to create and save a text file each time, is there any way to load the clipboard, and for each newline, perform the newToDo function?

This is my attempt so far but it doesn’t seem to work and puts the entire clipboard into one line, I can’t seem to find the proper delimiter.

try
    set oldDelims to AppleScript's text item delimiters -- save their current state
    set AppleScript's text item delimiters to {linefeed} -- declare new delimiters

    set listContents to get the clipboard
    set delimitedList to every text item of listContents

    tell application "Things"
        repeat with currentTodo in delimitedList
            set newToDo to make new to do ¬
                with properties {name:currentTodo} ¬
                at beginning of list "Next"
            -- perform some other operations using newToDo
        end repeat
    end tell

    set AppleScript's text item delimiters to oldDelims -- restore them
on error
    set AppleScript's text item delimiters to oldDelims -- restore them in case something went wrong
end try 

EDIT:
With the help of the answer below, the code is incredibly simple!

set listContents to get the clipboard
set delimitedList to paragraphs of listContents

tell application "Things"
    repeat with currentTodo in delimitedList
        set newToDo to make new to do ¬
            with properties {name:currentTodo} ¬
            at beginning of list "Next"
        -- perform some other operations using newToDo
    end repeat
end tell
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:45:07+00:00Added an answer on May 27, 2026 at 12:45 pm

    Applescript has a command called “paragraphs” which is very good at figuring out what the line delimiter is. As such give this a try. Note that you won’t need the “text item delimiters” stuff with this approach.

    set listContents to get the clipboard
    set delimitedList to paragraphs of listContents
    

    Note that if you want to use your code, this is the proper way to get a line feed character…

    set LF to character id 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to modify a line in PHP file that deals with data that
I'm trying to modify a ksh script to print out the line that contains
Im trying to modify the class below so that the scrolling text appears behind
I'm trying to modify the contents of an MSI file using Powershell. To do
Hi I'm trying to modify a web page so that it loads faster. Since
I've been trying to modify the AuditTrail code so that it does not copy
I trying to modify JournalArticle assets (need to set categories depending of article layout
I'm trying to modify some exports. I understand that this code doesn't work because
i've been trying to modify the program so that it could accept more than
I am trying to modify Apple's PhotoScroller example and I encountered a problem that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.