Hey there I am searching for a script to do the following
I would like to manually select the pdf file I want to rename and then select some text from the file and run the smart rule and the select text should become the new filename.
I bet it is easy but not good with AppleScript right now
I wanted to view the dictionary in apple script but it seems it doesnt work. I can select the devonthink dictionary in apple script but nothing opens up
You donât need a script for this Just right click on the selected text and choose Set Name As. Also available in the Edit menu. The default keyboard shortcut for the command is ^âI
I donât know whatâs going on with you AppleScript dictionary, it works fine for me.
(⌠Just to make sure: You need to double-click the dictionary to launch it, or choose âOpen dictionaryâ in the library toolbar. It is not enough to only select it.)
thanks for the hint with set name as. that is cool. BUT I would still need it as a part of a script because I have a smart rule that does more with the filename besides using the select text . basically I want to have 2 or 3 different things as the filename and the last part of the filename should just be the selected text.
In regard to the AppleScript dictionary thatâs what I did but still nothing is displayed then
Alright. You didnât list any other steps, so I just thought: No reason to complicate something very simple
I donât know what what to tell you about the dictionary. That is strange. Do you use multiple monitors or something? My first guess is the window opens but is hidden somewhere.
Can you open other dictionaries?
Does it make a difference if you open it from the Library? (Window > Library). This window:
You can fill in the rest, but generally youâll want the script to
set theText to selected text of think window 1
and then later
set the name of theDocument to theText
Your script of course will need to ensure there is a document selected, that there is text selected, etc. (In my example above theText and theDocument are placeholders for your own variables.) If you want the name to end up as a composite of the selected text plus other data, then youâll have statements to in the script to do the appending before set the name⌠occurs.
Sometimes the dictionary would not open on my first attempt. The second attempt always works. I donât know about the cause though; itâs been like this on my device for as long as I can remember.
So strange. I canât write AppleScript â but I never had a problem opening the dictionary! Is it some curse you gain along with mastering the dark arts?
Joking aside â yes, looking at examples is helpful. I have been looking at some of them trying to get a feel for the structure and syntax.
I use a script to assist with processing inbox entries; formatting filename, assigning tags, etc
Click to see script code for formatting filename
tell application "System Events" to keystroke "c" using {command down}
set theSelectedText to the clipboard
tell application id "DNtp"
set selectedNotes to get selection
repeat with selectedNote in selectedNotes
set theName to name without extension of selectedNote
set theNewName to theName & theSelectedText*
set name of selectedNote to theNewName
end repeat
end tell