Script to insert date with bold text

I’m just learning Applescript, so be patient. I’d like a script to insert the date with bold text, and then have the style switch back to plain, so the text I add after the date isn’t bold. I got this far:

set datestring to date string of (current date) & return
tell application "System Events"
	tell application "DEVONthink Pro" to activate
	tell process "DEVONthink Pro" to keystroke datestring
end tell

But I have no clue on how to make the text bold.

Thanks for your help,

Here’s a basic script without error handling and requiring a text visible in the frontmost window:

tell application "DEVONthink Pro"
	set theWindow to think window 1
	set theDateString to (current date) as string
	tell text of theWindow
		make new paragraph with data (theDateString & return) at beginning
		set font of paragraph 1 to "Helvetica-Bold"
	end tell
	tell theWindow to save without asking
end tell

Thanks, that helped.

Any suggestions on a good way to learn Applescript? I picked up “Applescript: the Missing Manual” at a used bookstore, but I’m not finding it to be all that helpful.


I can’t tell as I’ve never read anything about AppleScript, not even Apple’s documentation :smiley:

But the various scripts shipping with DEVONthink Pro (see ~/Library/Scripts and ~/Library/Application Support/DEVONthink Pro) are a good starting point. Just like the additional scripts in our support area.