Moving from Microsoft Office VBA to AppleScript:
MacTech's Guide to Making the Transition
Introduction
|
Table of Contents
Page Prev and Page Next buttons at bottom of the page.
|
April, 2007
Page 11
tell (get find object of textObject)
set forward to true
set wrap to find continue
set format to false
set match all word forms to false
set match case to false
set match sounds like to false
set match whole word to false
set match wildcards to false
clear formatting
clear all fuzzy options
clear formatting (its replacement)
end tell
end tell
If you're familiar with Word's Find Object you will recognize the standard method for setting options within a
With ActiveDocument.Range.Find
End With
block. But in AppleScript, you can go a step further in condensing the script if you wish, by putting all properties of the find object that need to be set into an AppleScript list (more on lists soon):
tell (get find object of textObject)
set {forward, wrap, format, match all word forms, ¬
match case, match sounds like, match whole word, ¬
match wildcards} to {true, find continue, false, false, ¬
false, false, false, false}
clear formatting
clear all fuzzy options
clear formatting (its replacement)
end tell
Note that setting multiple properties via a list only works in a tell block, not using of. On the other hand, you can get multiple properties in a list using of:
get {forward, wrap, format, match all word forms, match case, ¬
match sounds like, match whole word, match wildcards} ¬
of find object of text object of active document
For…Next, For Each…Next and Do While/Until…Loop : repeat…end repeat
Equivalent to VBA's For…Next, For Each…Next and Do While/Until…Loop loops are AppleScript's repeat…end repeat blocks, of which there are five types, as the AppleScript books will explain in detail. You will be tempted to use
repeat with eachItem in aList
< Previous Page Next Page>
- SPREAD THE WORD:
- Slashdot
- Digg
- Del.icio.us
- Newsvine