AppleScript ideas for OG?

Timothy Bates tim at maccs.mq.edu.au
Wed Jun 4 18:03:01 PDT 2003


Hi friendly weasel,

I would love to have an applescript which adjusted the vertical or
horizontal location of the labels of all currently selected lines to be the
same.

Problem addressed: If you make a graph with labeled lines, the labels often
don't line up nicely on a single horizontal line. And you can't select
multiple lables to apply an alignment.

Nature of solution: The script goes something like:
set currentLines to currentlySelectedLines()
if currentLines is {} then
    display dialog "if you select some lines, I will align their labels"
    return
else
    set labelList to my getLabelList(currentLines)
    set alignType to my figureOutWhetherToAlignHorOrVert(labelList)
    if alignType = "hor" then
        my alignY(labelList)
    else
        my alignX(labelList)
    end if
end if

to getLabelList(currentLines)
    return every label of currentLines
end getLabelList

to figureOutWhetherToAlignHorOrVert(labelList)
    --look and see if the x's or y's are close to the same
end figureOutWhetherToAlignHorOrVert

to alignY()
    --find the lowest, highest and mean x location
    --newY = which ever of lo and hi is closest to the mean
    set y of every label to newY
    return
end alignY


Dr Timothy Bates  <mailto:tim at maccs.mq.edu.au>
Macquarie Centre for Cognitive Science (MACCS)
Macquarie University
Ph 61 (2) 9850 8623
Fx 61 (2) 9850 6059

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/archive/omnigraffle-users/attachments/20030604/14209ff4/attachment.html


More information about the OmniGraffle-Users mailing list