Devonagent Pro Automation

I am trying to automate some activity with DevonAgent Pro. Is it possible to the following:

  • start a search with a search set and topic data supplied at the command line?
  • start a search with a search set and topic data supplied via apple script/automater?


  • automate the generation of the report to a specific location on the file system when a search completes, either via DA directly or via an apple script, automator or command line option?

Anyone have any insights on how to these items?

DEVONagent’s AppleScript dictionary contains the verbs to do most (perhaps all) of what you described.

DEVONagent doesn’t have a built-in command line interface, but there are examples in the DEVONagent Scripting portion of this forum from a user who wrote Ruby command-line wrappers for DEVONagent scripts.

So I see how I can start a canned search with a set like this:

tell application "DEVONagent" to search using set "xxx"

This works as long as set xxx is defined.

But, if I want to pass search terms into a common set like:

tell application "DEVONagent" to search using set "web (fast)"

How do I pass the search terms in? I don’t see a variable to use to pass the terms.

Also, in the dictionary, I don’t see any commands for running the report mechanism that is built into Devonagent. Are there commands or something not in the dictionary seen in script editor?

I don’t mean to be dense, but any links to docs or the like would be much appreciated!

Thanks, in advance.

I did just find the query part thanks to another post:

This works:

tell application "DEVONagent"
	set theQuery to "test"
	get URL "x-devonagent://runPlugin?identifier=com.devon-technologies.internet.plugin&query=" & theQuery
end tell

Thanks for that.
I’ll try and find some reference to the url structure. I have the slide deck manual, but saw nothing in it about this stuff.

Is there such a mechanism for the report generation as well, or perhaps a URL input? Is this URL mechanism defined in documentation anywhere?

Report generation – take a look (in AppleScript Editor) at the “Send (Mail).scpt” that is located at ~/Library/Application Support/DEVONagent/Scripts/Results/Send (Mail).scpt. This script can be refactored to send a report to a different location than mail. (Be sure to copy before editing!)

All of the scripts in Scripts folder are useful for learning the DEVONagent scripting dictionary. Also, browsing the dictionary in AppleScript Editor.

Thanks for the tips and the help. I’ll work on refactoring the script to do what I need. Much thanks for the rapid attention!

OK, I have tried to refactor the script using some code from the web. It is still not functioning, and I have no idea why? I put the displays in to try and troubleshoot and it gets to section 3, but it is not writing the file to disk…

-- Send results (Mail)
-- Created by Christian Grunenberg on Jun 04 2008.
-- Copyright (c) 2008. All rights reserved.

-- the email address of the recipient (if no address is defined, the mail is not automatically sent)
property pRecipient : ""

	tell application "DEVONagent"
		if not (exists search window 1) then error "No search window is open."
		set theSearch to search window 1
		if searching of theSearch then error "Search is not yet complete."
		set theResults to search results of theSearch
		if (count of theResults) is 0 then error "No search results."
		set theText to ""
		set theSubject to name of theSearch & ": " & ((count of theResults) as string) & " results found"
		repeat with theResult in theResults
			set theTitle to (title of theResult) as string
			set theDescription to (summary of theResult) as string
			set theURL to (URL of theResult) as string
			if theDescription is not "" and theDescription is not equal to theTitle then
				set theText to theText & theTitle & return & return & theDescription & return & return & "<" & theURL & ">" & return & return & return
				set theText to theText & theTitle & return & "<" & theURL & ">" & return & return & return
			end if
		end repeat
	end tell
	display alert "got to 1"
	set this_file to ((("/Users/xxx/Dropbox/DevonDrop/") as string) & "test.txt")
	my write_to_file(theText, this_file, false)
on error error_message number error_number
	if error_number is not -128 then display alert "DEVONagent" message error_message as warning
end try

display alert "got to 3"

on write_to_file(this_data, target_file, append_data)
		set the target_file to the target_file as string
		set the open_target_file to open for access file target_file with write permission
		if append_data is false then set eof of the open_target_file to 0
		write this_data to the open_target_file starting at eof
		close access the open_target_file
		return true
	on error
			close access file target_file
		end try
		return false
	end try
end write_to_file