← develop-28 9612 December 1996

develop-28 9612 December 1996

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

PDF page 12

assume the script is looking at a text block that contains the words “Hi there” in 12-point Helvetica type. For the first two examples, formAbsolutePosition is the key form; for the third example, the key form is formPropertyID, and for the fourth example it’s formRelativePosition. Although formRelativePosition is a simple key form, there’s one aspect of handling it that might not be obvious. The container parameter that your object accessor receives in this case is a reference not to a container but to an object inside a container in relation to another object inside that container. In other words, if a script asks for an object before or after another object in a container, as in get nam e of t he wi ndow af t er wi ndow " Sal es Char t " your object accessor will receive a keyForm parameter of formRelativePosition and a keyData parameter that contains a constant, either kAENext or kAEPrevious. Your accessor must then find the object either before or after the “contained” object. This means that to handle formRelativePosition, you’ll have to install an accessor that gets an object of one type from another object of the same type. Although the containment hierarchy for Sketch shows that windows don’t contain other windows, you will need a window-from-window accessor installed to handle formRelativePosition. If your accessors can find an object in a container, finding an object either before or after that object should be relatively easy, as long as you remember to install the accessor. Here’s how Sketch installs the accessor for its window object: er r or = AEI ns t al l Obj ec t Ac c es s or ( c W i ndow, c W i ndow, NewOSLAc c es s or Pr oc ( W i ndowFr om Appl i c at i onAc c es s or ) , 0L, f al s e) ; HANDLING EVERY If a script asks for every one of a certain kind of object, your accessor will receive a keyForm parameter of formAbsolutePosition and a keyData parameter with a descriptor type of typeAbsoluteOrdinal and a value of kAEAll, and you’ll return a descriptor that represents a collection of objects. The Sketch application returns an AEList of tokens that reference each object. Some examples of script fragments using every and their results are shown in Table 4. Again, assume the script is looking at a text block that contains the words “Hi there” in 12-point Helvetica type. Each every specifies another list level: one every will return a list, two will return a list of lists, and so on. Consider, for instance, this statement that navigates through the Text suite hierarchy: get ev er y c har ac t er of ev er y wor d of ev er y par agr aph of ev er y doc um ent develop Issue 28 December 1996 10 Table 3. Script fragments using simple keys and their results Script fragment Result type Example result word 2 word "there" character 1 of word 2 character "t" size of word 1 number (font size) 12 word before word 2 word "Hi"

Reading notes: Source text contains hyphenation and irregular word spacing from extraction (e.g., 'nam e', 'Sal es Char t') Text begins mid-document, so the primary heading is not visible

Printed dates
1996
Languages
English