Script to create index page for sharing web content

I search and gather info from DTP then publish to a web site for others to use. I make an index page with wiki-links to the material. Is there a script that can gather the titles of each item in a folder and make an index page of wiki-links… is it even possible. Seems like it would be a very helpful to those of us that share our research on the web. In one way… easy to think of ideas like this… maybe quite another to create a script to carry it out. Thanks in advance to anyone who has input on this. -bob

Bob,

This may not be the magic bullet, but here’s a method that works. URL Manager Pro is a bookmark utility that lets you collect URLs, rename the labels, and place them into folders. Then you publish the collection of bookmarks as an HTML page.

You can’t at present drag URLs from DT directly into URLMP. You must first select a URL and click on its address to launch your web browser. Then drag the browser’s link icon into URLMP. Rename the labels as you wish, arrange in folders, and publish as an HTML page.

If you write comments on the URLMP links, the comment lines appear below the hyperlinks.

Download the product from url-manager.com/.

Will

DEVONagent includes a script to add bookmarks to URL Manager Pro, here’s a slightly modified version for DEVONthink Pro:


-- Add bookmark to URL Manager Pro.
-- Created by Christian Grunenberg on Wed Mar 15 2006.
-- Copyright (c) 2006. All rights reserved.

tell application "DEVONthink Pro"
	try
		if not (exists think window 1) then error "No window is open."
		set theWindow to think window 1
		set theURL to URL of theWindow
		if theURL is missing value or theURL is "" then error "No page has been loaded."
		set theName to name of theWindow
		tell application "URL Manager Pro" to savebookmark theURL name theName info ""
	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

Here’s a script creating a very simple index page for the selected items:


-- Create index for selected items
-- Created by Christian Grunenberg on Wed Mar 15 2006.
-- Copyright (c) 2006. All rights reserved.

tell application "DEVONthink Pro"
	try
		set theSelection to the selection
		if theSelection is {} then error "Please select some items."
		set theIndex to ""
		repeat with theRecord in theSelection
			set theIndex to theIndex & (name of theRecord) & return
		end repeat
		set theRecord to item 1 of theSelection
		if exists parent 1 of theRecord then
			create record with {name:"Index", type:rtf, rich text:theIndex} in parent 1 of theRecord
		else
			create record with {name:"Index", type:rtf, rich text:theIndex}
		end if
	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

Activate the “Automatic WikiLinks” preference and select the “Names & Aliases” option. Then you should be able to export the selected items and the index page via File > Export > as Website…

I am amazed… it works perfectly. This does a lot for me. Thank you! Include this script in your next release it is a good one! -bob

Christian,

I just saved and ran the two scripts, and they both work flawlessly.

Thanks so much!

Will

I think this script broke with version 1.1. Any chance of getting it back? It was a great one!

The script has been actually developed for v1.1

Thanks for getting back to me … I found the problem. I was making “replicants” of my search in another folder. Then attempting to make the index in the folder of replicants. The script would create the index but would put the index back in the folder containing some of the original items. So… I created my search… duplicated (rather than replicate) in my new folder, then created the index in the new folder… no problem. Worked as designed. -bob