Information Technology Reference
In-Depth Information
Figure 57—Replacing text within a selection in TextEdit
1.
Open a Terminal window (open Finder, select the Applications list, and
then in the list of applications double-click Terminal within the UTILITIES
folder), and then type the following:
MKDIR ~/LIBRARY/SCRIPTS/
Close the Terminal window.
2.
Start AppleScript Editor, which you'll find in the UTILITIES folder within the
Applications view of Finder.
3.
Click the program's menu, and then select the Preferences entry. In the
dialog box that appears, ensure the General tab is selected, and check
the Show Script Menu in Menu Bar heading. This will add a new icon to
the top right of the screen, which you can ignore for the moment. Close
the Preferences dialog box.
4.
Back in the main AppleScript Editor window, type the following code:
TELL APPLICATION "TEXTEDIT"
SET WC TO COUNT WORDS OF DOCUMENT 1
IF WC IS EQUAL TO 1 THEN
SET TXT TO " WORD."
ELSE
SET TXT TO " WORDS."
END IF
SET RESULT TO (WC AS STRING) & TXT
DISPLAY DIALOG RESULT WITH TITLE "WORD COUNT" BUTTONS {"OK"} DEFAULT
BUTTON "OK"
END TELL
 
 
 
 
Search WWH ::




Custom Search