Guest
2012-07-06, 11:40 AM
Hi John,
Yes, that does seem a good idea – a direct test for root status would be an empty
incoming lines collection, and the script to install it in the template nodes might look roughly like this:
Code:
-- GIVES ALL SHAPES AN ACTION SCRIPT WHICH GRAYS ALL LINKS EXCEPT FOR THE ANCESTRAL LINKS
-- OF THE SHAPE CLICKED WITH THE BROWSE TOOL
-- THE ANCESTRAL PATH IS RECOLORED TO RED
-- CLICKING THE ROOT NODE RESETS TO A DEFAULT
-- ver 0.07
set pScript to "
property pblnNodes : false
property pblnLinks : true
property pNormalColor : {0,0,0} -- black
property pBackColor : {32767, 32767, 32767} -- grey
property pForeColor : {65535, 0, 0} -- red
property pNormalWidth : 1
property pBackWidth : 1
property pForeWidth : 3
set oCanvas to canvas of self
set refLines to a reference to lines of oCanvas
if count of (incoming lines of self) < 1 then
tell refLines
set stroke color to pNormalColor
set thickness to pNormalWidth
end tell
else
set lstPaths to my GetPath(self, false,true)
tell refLines
set stroke color to pBackColor
set thickness to pBackWidth
end tell
repeat with oLine in lstPaths
tell oLine
set stroke color to pForeColor
set thickness to pForeWidth
move it to beginning of refLines -- bring to front, in case of orthogonal overlap
end tell
end repeat
end if
on GetPath(oShape, blnNodes, blnLinks)
tell application id \"OGfl\"
set lstIncoming to incoming lines of oShape
if lstIncoming ≠ {} then
set oLink to first item of lstIncoming
set lstPath to my GetPath(source of oLink, blnNodes, blnLinks)
if blnLinks then set lstPath to lstPath & {oLink}
if blnNodes then set lstPath to lstPath & {oShape}
else
if blnNodes then
set lstPath to {oShape}
else
set lstPath to {}
end if
end if
return lstPath
end tell
end GetPath
"
-- ONLY RUN THIS IF YOU WANT TO APPLY THE SCRIPT ABOVE
-- APPLY SCRIPT ACTION TO *EVERY* SHAPE ON THE CANVAS
tell application id "OGfl"
set script of shapes of canvas of front window to pScript
end tell
Last edited by RobTrew; 2012-07-07 at 02:41 PM..