Creating MediaWiki-style links of a group of records

This script puts a set of MediaWiki-style links on the clipboard, one for each record in a selection. It is useful if you have a MediaWiki wiki on localhost that you are maintaining, and wish to put a list of documents in a posting. See this posting for more.


tell application id "com.devon-technologies.thinkpro2"
	set thisDatabase to current database
	set thisSelection to the selection
	if thisSelection is {} then error "Please select something"
	set the clipboard to ""
	repeat with thisItem in thisSelection
		set theLink to the reference URL of thisItem
		set theName to the name of thisItem
		set theWikiLink to "[" & theLink & " " & theName & "]"
		set the clipboard to (the clipboard) & theWikiLink & return
	end repeat
end tell

thanks for the script! This might also be useful: viewtopic.php?f=2&t=12662

Thanks korm for the useful script at which I made a slight addition. Specifically, I added the break line tag (
) in your code for the theWikiLink so as, every wiki link to be in its own line in the view MediaWiki mode.


tell application id "com.devon-technologies.thinkpro2"
	set thisDatabase to current database
	set thisSelection to the selection
	if thisSelection is {} then error "Please select something"
	set the clipboard to ""
	repeat with thisItem in thisSelection
		set theLink to the reference URL of thisItem
		set theName to the name of thisItem
		set theWikiLink to "[" & theLink & " " & theName & "]<br/>"
		set the clipboard to (the clipboard) & theWikiLink & return
	end repeat
end tell