• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Basic Script in DT Pro
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic Script in DT Pro


  • Subject: Re: Basic Script in DT Pro
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 14 Feb 2015 11:20:04 -0600

On Feb 13, 2015, at 17:30, Chris Nidel <email@hidden> wrote:
I am trying to get a file by name.  I have a CSV file with names of files and metadata.  I was to take the file names, find the files, then assign various metadata from the CSV to the files by name.  I am doing this in DevonThink Pro.  I can read the file names from the CSV file, but when i use:
______________________________________________________________________

Hey Chris,

set theFile to lookup records with file ["LEVP00024290.pdf”]

Why do you have brackets and smart-quotes in this line?  The syntax calls for text.

it returns {} despite there being a file by that name.

Do you have the correct database open?  Lookup records with file defaults to the current database unless you add in <database>.

(the reason I ask 2 already, is because i used lookup records with tags instead and that worked to get files, but then i still couldn’t set the properties i tried setting.)

When you look up records the result is a list.  When you set properties of the found item or items you have to talk to each individual one.

tell application "DEVONthink Pro"
  set recoList to lookup records with file "Your-File-Name.pdf"
  set recoListLength to length of recoList
  if recoListLength = 1 then
    set theRecord to item 1 of recoList
    tell theRecord
      set label to 2
    end tell
  else
    if recoListLength = 0 then
      error "Zero records were found!"
    else if recoListLength > 1 then
      error "More than 1 record was found!"
    end if
  end if
end tell

* I'm testing in DEVONthink Pro Office, but the AppleScript dictionary should be the same.

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Basic Script in DT Pro
      • From: Chris Nidel <email@hidden>
References: 
 >Basic Script in DT Pro (From: Chris Nidel <email@hidden>)

  • Prev by Date: Re: Kindle Mac App
  • Next by Date: Re: Kindle Mac App
  • Previous by thread: Basic Script in DT Pro
  • Next by thread: Re: Basic Script in DT Pro
  • Index(es):
    • Date
    • Thread