• 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: Sun, 15 Feb 2015 11:03:43 -0600

On Feb 14, 2015, at 17:41, Chris Nidel <email@hidden> wrote:
Thanks a bunch.
______________________________________________________________________

Hey Chris,

You're welcome.

however, when I try to make it set the contents of the tag, it does not work.

This corrected handler works.

----------------------------------------------------------------------
on transfer_data(sub_file_name, sub_full_tag)
tell application "DEVONthink Pro"
set recoList to lookup records with file sub_file_name
set recoListLength to length of recoList
if recoListLength = 1 then
set theRecord to item 1 of recoList
tell theRecord
set tags of theRecord to {sub_full_tag}
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
end transfer_data

transfer_data("Ben.Test.OCR.pdf", "NUTS!")
----------------------------------------------------------------------

When creating a list please use curly-braces instead of braces - braces compile to curly-braces anyway.

set tags of theRecord to {sub_full_tag}

You were trying the set the tag, and there is no such property.

set the tag of theRecord to [sub_full_tag] # (Your Code)

See how tag is the same color as theRecord and sub_full_tag?  That tells you tag is just a variable name and not a proper property of a record.

The actual tags property is a list, as you can get/set more than one tag at once.

Note that setting tags will destroy any already existing ones.

If you want to preserve any extant tags you have to extract them and add them to your new tag list.

--
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>)
 >Re: Basic Script in DT Pro (From: Christopher Stone <email@hidden>)
 >Re: Basic Script in DT Pro (From: Chris Nidel <email@hidden>)

  • Prev by Date: Re: Scripting alerts
  • Next by Date: Re: Basic Script in DT Pro
  • Previous by thread: Re: Basic Script in DT Pro
  • Next by thread: Re: Basic Script in DT Pro
  • Index(es):
    • Date
    • Thread