Hi,
I am updating an Applescript that reads data from my calendar and writes into a year planner that gets drawn in Omnigraffle. My aim, in this update, is to set the colour of portions of the text in a rectangle. Looking at Applescript written by Omnigraffle shows that the text: value of a cell may be a list of text values, each with its own style commands. Note I have added line endings for clarity.
tell canvas of front window
make new shape at end of graphics with properties {fill:no fill, draws stroke:false, draws shadow:false, autosizing:full, size:{512.32, 28.447998},
text:{{size:16, alignment:center, color:{1.0, 0.13552, 0.16384}, font:"HelveticaNeue", text:"Here is "},
{size:16, alignment:center, color:{0.137255, 0.368627, 0.0}, font:"HelveticaNeue", text:"Some"},
{size:16, alignment:center, color:{1.0, 0.13552, 0.16384}, font:"HelveticaNeue", text:" Text : "},
{size:16, alignment:center, color:{0.704176, 0.37007, 0.115055}, font:"HelveticaNeue", text:"The Quick Brown Fox"},
{size:16, alignment:center, color:{1.0, 0.13552, 0.16384}, font:"HelveticaNeue", text:" Jumps OVER "},
{size:16, alignment:center, color:{0.156863, 0.203922, 0.313726}, font:"HelveticaNeue", text:"the LAzy Dog"},
{size:16, alignment:center, color:{1.0, 0.13552, 0.16384}, font:"HelveticaNeue", text:"."}}, origin:{90.708662, 58.110237}, thickness:2}
end tell
My code generates the text portion of the command and stores it in a variable tText e.g.
{font:kfont, size:kCalEventTextSize, alignment:left, color:{0, 47802, 0},text:"Grn Bin"},{font:kfont, size:kCalEventTextSize, alignment:left, color:{33924, 16962, 12079},text:"Red/Brn Bin"}
Next, the string variable, tText, is wrapped in brackets and used in a command sent to OmniGraffle (inside a tell block) :
set tText to "{" & 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}}
This causes OmniGraffle to print out the full command as stored in variable tText into the rectangle rather than interpreting it as a command that includes variables.
I think that I should be using the RunScript command but am uncertain how ?
Any thoughts?
S