adding variable to name of Devonthink appleScript

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I am VERY new to, AS but have had luck in general modifying existing scripts to do what I need to. Right now, I am trying to exert a file to devonthink (which I have a script that works to do that), but hoping I can alter the name of the script based on a tag that I have added to the file.

I can't figure out if this is possible or not.

Where it says "create location" . .. . {input attributes} would ideally be the name of the (first?) tag in the file name.

tell application id "com.devon-technologies.thinkpro2"
launch
set theDatabase to open database "/Users/russell/Docs-DO NOT SYNC/Devon Think/Statements (locked).dtBase2"
set theGroup to create location "Statements (locked)/{inputAttributes}" in theDatabase
import theFile to theGroup
end tell

Obviously this will just create a folder called "Statements (locked)/{inputAttributes}", as opposed to using the variable, which isn't helpful ;-)

I did click the "Add any attributes to be imported into this script" and selected "Tags", I just can't figure out how to actually get the tag into the script, particularly into the correct section of the script.
rosenblumr
 
Posts: 2
Joined: Tue Oct 17, 2017 11:48 am

The input attributes is a list with items in the order that you specified in the input attributes UI. On top of that, tags are a list as well so you have a list within a list. Search around on how to manipulate lists in AppleScript.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I guess what I cent seem to figure out, is how to put the variable inside of the quotation marks that already has the file name in it. I did look around, including here:
viewtopic.php?f=4&t=6818&p=19476&hilit=pass+variable+to+appleScript#p19476

and here:

viewtopic.php?f=4&t=7403&p=21443&hilit=variable+to+appleScript#p21443

here:
viewtopic.php?f=3&t=1770

and of course here:
https://www.noodlesoft.com/manual/hazel ... avascript/

I think I just don't understand what I am doing to get the data to propagate where I need it to.

I am not even sure if I need to use input attributes, as I really just want it to take the first tag, and add it to the "file group" name.
rosenblumr
 
Posts: 2
Joined: Tue Oct 17, 2017 11:48 am

Check out this article on how to combine strings: https://www.safaribooksonline.com/libra ... 04s03.html
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support