Smile Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
Smile Reference Manual Satimage-software http://www.satimage-software.com Copyright c 2003 Satimage (France) May 1st, 2003 Contents I Smile, the better script editor for AppleScript 11 1 About Smile Reference Manual 12 1.1 How Smile’s documentation is organized ......................... 12 1.1.1 The text files included in the distribution .................... 12 1.1.2 Smile’s on-line help menu ............................. 12 1.1.3 The resources available on the Web ........................ 13 1.2 The scope of Smile Reference Manual .......................... 13 1.3 Conventions used in Smile Reference Manual ...................... 13 1.4 What you should read ................................... 14 1.5 Reference Manual Change History ............................ 14 2 An introduction to Smile 15 2.1 Overview .......................................... 15 2.2 To get started quickly ... ................................. 15 2.3 Short features list ...................................... 15 3 Installation 17 3.1 What you should install .................................. 17 3.2 Installing Smile from scratch ............................... 18 3.3 Installing a new release .................................. 18 3.3.1 Full install ..................................... 18 3.3.2 Partial upgrade ................................... 18 3.4 Installing the Satimage osax ................................ 19 3.4.1 First install of the Satimage osax ......................... 19 3.4.2 Installing an upgrade of the Satimage osax ................... 19 3.5 Installing additional components ............................. 19 3.6 Multiple users support ................................... 19 2 CONTENTS 3 4 Entering the world of Smile: scripting and debuging in text windows 21 4.1 Smile, a different experience of scripting ......................... 21 4.2 Scripting and debug in text windows ........................... 21 4.2.1 Making a new text window ............................ 21 4.2.2 Executing scripts in text windows ........................ 21 4.2.3 Displaying the result of execution ......................... 22 4.2.4 The scope of the variables — Smile’s context .................. 22 5 Working with scripts in script windows 24 5.1 About script documents formats ............................. 24 5.2 Making a new script window ............................... 24 5.3 Opening a script document ................................ 25 5.4 Working with a script window ............................... 25 5.5 Editing an applet or a droplet ............................... 26 5.6 Saving a script document ................................. 26 5.7 Saving an applet or a droplet ............................... 27 5.8 Saving a script without its source ............................. 27 6 Editing text in text windows 28 6.1 About text documents formats .............................. 28 6.1.1 Unicode support .................................. 28 6.1.2 ISO-8859-1 support ................................ 28 6.2 Making a new text window ................................ 28 6.3 Opening a text document ................................. 29 6.4 Closing a text window ................................... 29 6.5 Saving a text window ................................... 29 6.6 Using drag and drop in text windows ........................... 29 6.7 Editing text ......................................... 30 6.8 Selection keyboard shortcuts — Mouse tricks ...................... 31 6.9 Text searches ........................................ 31 7 Using the dictionaries 33 7.1 Searching a term’s definition ............................... 33 7.2 Opening the dictionary of an application — Opening the dictionary of a Scripting Addition ........................................... 33 7.3 Opening the dictionary of an application which is running — Opening the dictionary of a Scripting Addition which is installed ........................ 34 7.4 Opening the dictionary of the target application of a window ............. 34 7.5 Opening AppleScript’s dictionary ............................. 34 4 CONTENTS 8 Scripting faster with the “Balance” command 35 8.1 Syntax pre-typing ...................................... 35 8.2 Parentheses balancing ................................... 35 8.3 Wrappers balancing .................................... 36 8.4 “Balance()” call to your script .............................. 36 9 The Scripts menu 37 9.1 How to use the “Scripts” menu .............................. 37 9.2 Adding and removing menu items to/from the “Scripts” menu ............ 38 9.3 Displaying hierarchical menus in the “Scripts” menu .................. 38 9.4 Grouping items in the “Scripts” menu .......................... 38 9.5 Using aliases in the “Scripts” menu ............................ 39 9.6 Sorting the items of the “Scripts” menu ......................... 39 9.7 Providing shortcuts to the items of the “Scripts” menu ................. 39 10 Connecting a window to an application — The “tell ...” feature 41 10.1 When to connect a window to an application ...................... 41 10.2 How to connect a window to an application ....................... 41 10.3 Making scripts into “raw code” .............................. 41 10.4 Targeting an application by script ............................ 42 10.5 The context of a window connected to an application .................. 42 10.6 “Find definition” in a window connected to an application ............... 42 10.7 Known bugs ......................................... 42 11 Comfort and productivity 43 11.1 The Worksheet ....................................... 43 11.2 Handling windows efficiently ................................ 43 11.3 The “Recent files” menu .................................. 44 11.4 The “Favorites” menu ................................... 44 11.5 Preferences ......................................... 44 11.5.1 The “General” pane ................................ 44 11.5.2 The “AppleScript” pane .............................. 45 11.5.3 The “Windows” pane ............................... 46 11.6 Programmer’s tools ..................................... 46 11.7 Variables that are saved when you quit Smile ...................... 47 II The AppleScript-based automation engine 49 12 Advanced text editing 50 CONTENTS 5 12.1 Advanced text searches .................................. 50 12.1.1 The Enhanced Find panel ............................. 50 12.1.2 Searching in folders ................................ 50 12.1.3 Regular expressions ................................ 50 12.2 Comparing files ....................................... 51 12.3 Text tools .......................................... 51 12.3.1 Make an AppleScript string ............................ 51 12.3.2 ISO-Latin1 to Mac and Mac to ISO-Latin1 ................... 51 12.3.3 Open ISO-Latin1 ... ................................ 51 12.3.4 Measure Text .................................... 52 12.3.5 Sort paragraphs .................................. 52 13 The scriptable text editor — The Text Suite 53 13.1 Specifying a text range in a window of Smile ...................... 53 13.2 whose, where and every .................................. 54 13.3 before and after ....................................... 54 13.4 The properties of the text ................................. 54 14 The UTF-16 editor 55 14.1 Overview .......................................... 55 14.2 Using the UTF-16 editor .................................. 55 15 Smile custom dialogs 56 15.1 Overview .......................................... 56 15.2 Running a custom dialog .................................. 56 15.3 Running a custom dialog by script ............................ 56 15.4 The basics of custom dialogs ............................... 57 15.5 Creating your own custom dialogs ............................ 57 15.5.1 Making a new custom dialog ........................... 57 15.5.2 Populating a new custom dialog ......................... 57 15.6 Editing a custom dialog .................................. 58 15.6.1 The edit mode ................................... 58 15.6.2 Dialog editing features ............................... 59 15.6.3 The dialog editing tools .............................. 59 15.7 Scripting a custom dialog ................................. 60 15.7.1 The basic properties of the controls ........................ 60 15.7.2 Events received by the scripts ........................... 61 15.8 Making a custom dialog multi-lingual .......................... 64 15.8.1 What is localization? ................................ 64 15.8.2 How to localize a dialog .............................. 64 6 CONTENTS 15.8.3 How to localize Smile ............................... 66 15.8.4 How to localize “Localize” ............................. 66 15.9 Making a custom dialog into a stand-alone application ................. 66 15.9.1 Why to make a custom dialog into a stand-alone application ......... 66 15.9.2 Why not to make a custom dialog into a stand-alone application ....... 66 15.9.3 The limits of a stand-alone application ...................... 67 15.9.4 Making a stand-alone application ......................... 67 15.10Attaching a custom dialog to an object .......................... 67 16 Scripting Smile — The basics 69 16.1 Overview .......................................... 69 16.2 Manipulating objects — The object model ........................ 69 16.2.1 Accessing an object ................................ 69 16.2.2 Making a new object by script .......................... 70 16.3 Programming the objects — The object scripts ....................