ADot ( or AGraphviz )

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
Hi,

I have found simple (and free) way to draw graph by AutoIt script.
It uses Dot notation to do it.

; AutoGraph Visualization
; Auto Graphviz (Graph Visualization Software)
; Basic link - http://www.graphviz.org/
; ADot uses WinGraphviz Win32/COM object
; Link - http://wingraphviz.sourceforge.net/wingraphviz/

$dot = ObjCreate('Wingraphviz.dot')
if Not IsObj($dot) then
  Msgbox(0,'','Unable to create Wingraphviz.dot')
    Exit
endif
                
;Sample data of DOT
$GDesc = ''
$GDesc &= 'digraph G {'
$GDesc &= 'size ="4,4";'
$GDesc &= 'main -> parse [weight=8];'
$GDesc &= 'parse -> execute;'
$GDesc &= 'main -> init [style=dotted];'
$GDesc &= 'main -> cleanup;'
$GDesc &= 'execute -> { make_string; printf}'
$GDesc &= 'init -> make_string;'
$GDesc &= 'edge [color=red];'
$GDesc &= 'main -> printf [style=bold,label="100 times"];'
$GDesc &= 'make_string [label="make a\nstring"];'
$GDesc &= 'node [shape=box,style=filled,color=".7 .3 1.0"];'
$GDesc &= 'execute -> compare;'
$GDesc &= 'main 
[shape=polygon,sides=8,peripheries=3,color=lightyewllow];}'
$GDesc &= 'execute 
[shape=polygon,sides=9,peripheries=3,color=lightblue,style=filled];}'

;Parse DOT description
if Not $dot.Validate($GDesc) then
 Msgbox(0,'','DOT Format Error')
endif
                
;Create SVG image
$strSVG = $dot.ToSVG($GDesc)
$FilePath = @ScriptDir & "\test.svg"
if StringLen($strSVG) then
  $File = FileOpen ($FilePath, 2)
  FileWrite($File, $strSVG)
 $File = FileClose($File)
; Open it 
 ShellExecute($FilePath, '', @ScriptDir, 'open')
endif

exit

Enjoy,
Valery
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.