(* OmniOutlinerToMap This AppleScript sample demonstrates one technique for building a map from hierarchical data. It extracts the topics from an OmniOutliner outline and builds a map with the same structure in Mindjet MindManager. For more information on OmniOutliner, please visit the Omnigroup's product web site at: Copyright 2006 Mindjet Corporation. All rights reserved. *) (* Main run handler. This routine handles the basic process. It examines the Omni outline and determines whether it has one main topic or several. It then starts an appropriate MindManager map. It then calls subroutine handlers to build up the map based on the contents of the outline. *) tell application "OmniOutliner" if document 1 exists then local mapTitle set numRootChildren to count of children of document 1 if numRootChildren is 1 then -- There is only one child item in the omni document -- that item becomes the root of the MindManager map set rootOmniItem to child 1 of document 1 set mapTitle to topic of rootOmniItem else -- There is more than one child item in the omni document -- the document itself becomes the root of the MindManager map. set rootOmniItem to document 1 set mapTitle to name of document 1 end if -- Create a new map set mindManagerMap to my MakeNewMindManagerMap(mapTitle) -- Add the omni outline to the map tell application "Mindjet MindManager" my AddOmniChildrenToMapTopic(rootOmniItem, central topic of mindManagerMap) end tell else display dialog "Please open the OmniOutliner document you want to convert to Mindjet MindManager" end if end tell (* Given an item in an Omni outline, and a topic in a MindManager map, recursively add the chidren of the outline as topics in the map. *) on AddOmniChildrenToMapTopic(rootOmniItem, mindManagerTopic) tell application "OmniOutliner" repeat with aChild in children of rootOmniItem set topicTitle to (a reference to topic of aChild) tell application "Mindjet MindManager" set mapTopic to make new subtopic for mindManagerTopic with properties {title:topicTitle} my AddOmniChildrenToMapTopic(aChild, mapTopic) end tell end repeat end tell end AddOmniChildrenToMapTopic (* Create a new map in MindManager and change the title of the central topic to match the one passed as a parameter. *) on MakeNewMindManagerMap(centralTopicTitle) local newMap tell application "Mindjet MindManager" activate set newMap to make new document set title of the central topic of newMap to centralTopicTitle end tell return newMap end MakeNewMindManagerMap