"set title as" keyboard short-cut doesn't work

I have set a keyboard short-cut for “set title as”. When I hit the short-cut, it executes “make link”, which is the next option down on the sub-menu. Is this a glitch in DT Pro?

Which shortcut did you use? But as “Set Title As” is only part of contextual menus and as those menus are built on the fly, I doubt that this will work anyway.

I used shift-apple-M.

When I hit this combination in a rtf document, it makes a link. What do you mean “built on the fly?”
[/quote]

The shift-Apple-Cmd keystroke is by default assigned to the “Format>Make Link” menu command. Are you creating your shortcut using the System Preferences, Keyboard Shortcuts feature? If so, I don’t believe this will work with contextual menus items.

Um…how can I set up a keyboard shortcut in a contextual menu? I had been using the System Preferences/Keyboard Shortcuts approach.

I don’t believe it is possible to have a keyboard shortcut dedicated to a command that appears only in contextual menu. That’s what Christian is referring to when he says that the menu is built ‘on the fly.’ The commands that are available depend on the context, thus the name contextual menu.

I’ve always been amazed by those people who can instantly recall dozens of keyboard shortcuts without missing a beat.

I can’t. :slight_smile:

I’ve done it, baaba! For this exact one, ‘Set Title As’, which I think used to be in a normal menu and I had to have a keyboard shortcut.

I’ve been using iKey for a long time and figured out a way use that to accomplish this - it’s several commands, and if anyone who has iKey wants to know how I’ll go back in and see what I did back then.

Works flawlessly!

Well, I searched around a little bit in the English.lproj using Interface Builder, but couldn’t find the nib file with the appropriate context menu. I suspect that this is because, as was indicated earlier, that this particular context menu is built “on the fly.” I really want a shortcut for “Set Title As” because I frequently use the service shortcut to make a new rtf file from abstracts I’m grabbing on the web and then need to rename. Any ideas? I don’t own iKey, but Keyboard Maestro, so if you (cyol) can tell me how it’s done in iKey, maybe I can adapt for Keyboard Maestro. Or perhaps, somebody knows the nib file in which this context menu resides. Thanks.

I suppose you could consider this a lo-tech way of doing it, but hey it works!

Let’s see if I can translate this into words:

  • Manually- Select text that you want for the item’s title
  • iK- Press ctrl
  • iK- simulate mouseclick
  • iK- Type the word “set”
  • iK- Press Return

Those are the commands which in a set together, assigned to the fkey of your choice, execute the actions.

Basically, it’s doing a control-click on the selected text in the body of the item, then by keying in the word ‘set’, the menu selection jumps to that item in the contextual menu. Then Return to accept it.

Does that make sense?

-c

Here’s another solution:


tell application "DEVONthink Pro"
	try
		if not (exists think window 1) then error "No window is open."
		set theSelection to the selection
		if (count of theSelection) is not 1 then error "Please select one content."
		set theText to selected text of think window 1 as string
		if theText is "" then error "No text is selected."
		set theRecord to item 1 of theSelection
		set name of theRecord to theText
	on error error_message number error_number
		if the error_number is not -128 then
			try
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

Save this script in the folder ~/Library/Application Support/DEVONthink Pro folder and use for example a name like “Set Title___Cmd-Option-T.scpt”. Then you can use the shortcut Command-Option-T.

Thanks a lot for this script, Christian. And for all the other scripts you recently posted in the forum 8)
Perhaps you should collect them and put them on the download page. As an absolut beginner in AppleScript i also would like something like the OmniOutliner SDK for using AppleScript to control OmniOutliner… for DevonThink.
And i would love a built-in shortcut for the “set title as” command in a future version of DevonThink :unamused:

Louise

Me too, I’d like to have Christian’s scripts available at some place.

Alb

Some of the scripts will be probably added to the example scripts on our download page sooner or later.

Christian,

Many thanks for the script, problem solved.

I’d love to use this script, but when I try to save it from Script Editor I get this message:


Syntax Error
Expected end of line but found identifier

The word “alert” is highlighted.

Mark

Probably you’re still using Mac OS X 10.3.9, right? Then replace the lines…


         try 
            display alert "DEVONthink Pro" message error_message as warning 
         on error number error_number 
            if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1 
         end try 

…with…


display dialog error_message buttons {"OK"} default button 1 

Note: All scripts of DEVONagent & DEVONthink Pro try to use the more appealing alerts of Tiger.

Thanks! That did it.
I did have to change the name of the script to include -Shift-, as Cmd-Option-T is captured by DTPro under Format>Style>Plain. But this script is much faster and more convenient than using the contextual menu.

Mark

I tried this today and I can’t get it to work. I am using the latest version of Leopard and Devon think Pro Office. Do I have to change anything to the script to get the keyboard combo working again?

The shortcuts Cmd-Control-T, Cmd-Option-T and Cmd-Shift-T are already used, you have to use another combination.