My Applescript commands OmniGraffle to create a year planner and populate the cells with data from my user calendar. I have just updated the script to add colour to certain entries.
The year planner displays text entries for each day in a single OmniGraffle rectangle, with multiple calendar entries being merged into a entry. The default text colour for an entry is black however each is searched and a different text colour is assigned depending on any keywords that are found.
OmniGraffle accepts multiple text strings in the form of a list of text records where each record contains a number of optional properties along with the text string that is to be displayed. My sub routine builds the contents of the this list and returns the following list elements:
{{font:"Gill Sans", size:9, color:{0, 47802, 0}, alignment:left, text:"Grn Bin"}, {font:"Gill Sans", size:9, color:{65535, 8995, 10794}, alignment:left, text:" KP Dentist 09:15"}, {font:"Gill Sans", size:9, color:{35723, 0, 35723}, alignment:left, text:" tribunal doncaster "}}
This list of elements is stored in a variable tText which gets inserted into another command that tells Omnigraffle to create a rectangle and set its text to the contents of tText:
make new shape at end of graphics of first canvas with properties {origin:{Col3LeftMargin, myVerticalCursor}, size:{myNotesColWidth, myNormalCellHt}, draws shadow:false, name:"Rectangle", user name:"MyEntry", fill color:tCellColour, text:tText, user data:{CellDate:userDataDate}}
The issue is that when tText is built in the subroutine and the result is passed to OmniGraffle via the main body of the script, OmniGraffle ignores the property “alignment:left” while correctly actioning all the other properties. If however a test list is created in the main body of the script, OmniGraffle uses the alignment property correctly.
The only difference that I can see in the creation of the property lists is that one created in the main script is inside a tell block while the other, in the subroutine, is not. Sure enough when I add a tell statement to wrap the code in the subroutine the alignment property is set and read correctly by OmniGraffle.
I am baffled as to what is going on and seek enlightenment.
S