I am new to apple script and scripting the application Omnigraffle Professional . As per the requirement the document in loop each time it makes a new canvas to make some graphics ,( boxes) . I have to name the canvases of the document , like : “Level 1 : Some text” which is right now canvas 1 or any canvas number . I tried a lot to do it but could not succeed . Please help to rename the canvas of the document so that end users can easily go on the desiserd canvas and see their graphics .
Thanks in advance
kind regards
krishna
The code for your preview is as follows :
on make_graph(title, graph_list)
– get the new canvas
– get the title for the graph and sublevel list
– make the title box
tell front document of application “OmniGraffle Professional”
–making the new canvas
–counting the total number of canvases
–getting the canvas number for graphs
make new canvas
set count_canvas to count of canvases
set canvas_no to count_canvas - 1
tell canvas canvas_no
–here we want to name the canvas so that it has the new title for it
– create the title box
make new shape at end of graphics with properties {gradient color:{0.666667, 0.666667, 0.666667}, magnets:{{0, 1}, {0, -1}, {1, 0}, {-1, 0}}, text:{size:12, font:“FrutigerLTStd-Light”, alignment:center, text:title}, size:{360.0, 40}, origin:{100.0, 50}}
--counting the number of boxes to make graph
set count_boxes to length of graph_list
repeat with i from 1 to count_boxes
set my_y_position to (40 + (i * 80))
make new shape at end of graphics with properties {gradient color:{0.666667, 0.666667, 0.666667}, magnets:{{0, 1}, {0, -1}, {1, 0}, {-1, 0}}, text:{size:12, font:"FrutigerLTStd-Light", alignment:center, text:item i of graph_list}, size:{180.0, 40}, origin:{196.0, my_y_position}}
-- connect the boxes
-- the following if clauses are needed to assure that the first and second box get well connected
if i = 2 then
try
make new line at end of graphics with properties {point list:{{286, 74.16}, {286, 110}}, head type:"FilledArrow"}
set source of graphic -1 to graphic -3
set destination of graphic -1 to graphic -2
end try
end if
if i > 2 then
try
make new line at end of graphics with properties {point list:{{286, 74.16}, {286, 110}}, head type:"FilledArrow"}
set source of graphic -1 to graphic -4
set destination of graphic -1 to graphic -2
end try
end if
end repeat
end tell
end tell
end make_graph