routines.htmlTEXTVIZF›µ2n#µ2n#ƒ‰ Smile routines

Smile routines

Smile is attachable. Every Smile object, each window, each dialog, the application itself, has a script (possibly empty). Many functionalities of Smile are handled by these scripts.
Some of these scripts are available in any context and their handlers can be called from any script. These scripts are: the "Context" class script and, to some extent, the "Application" class script.
From Smile, or from another application - provided Smile is running - you can call the handlers contained in these scripts. We list below the most useful of them. See advanced script handling about listing all the handlers of a script.

Displaying text

FatalAlert (theString)
Displays, in an alert box, the string stored in 'theString'.

AskUser (thePrompt,theDefaultReply)
Asks the user to provide a string, and returns this string. The user is prompted by the string stored in 'thePrompt'. The dialog box displays the string stored in 'theDefaultReply' as the default reply. If the user cancels, the routine sends the error "User canceled".

dd (theString)
Displays, in a dialog box with one "OK" button, the string stored in 'theString'. The dialog box is "modal": the user must click "OK" to resume.

ShowMessage (theString)
Displays, in a small long window named "Message", ˆ la Hypercard, the string stored in 'theString'. This window is not modal. Use it, for instance, to display a progress report.

HideMessage ()
Suppresses the "Message" window created by the 'ShowMessage' command.

msg (theString)
Appends, at the end of the Worksheet , the string stored in 'theString', followed by a carriage return. If the Worksheet is not opened, it will first be opened in a new window.

log (theThing)
Appends, at the end of the Worksheet, the contents of the 'theThing' variable, followed by a carriage return. If the Worksheet is not opened, it will first be opened in a new window.

logVar (theVariableAsString)
The parameter must contain the name of a variable as string. For instance: logVar("total"). Will append, at the end of the Worksheet, the contents of the variable, followed by a carriage return. If the Worksheet is not opened, it will first be opened in a new window.
logVar must be used to display the contents of a variable which contains references to objects owned by an application. For instance the 'startup disk' of the Finder.

Miscellaneous utilities

sort (theList)
Assuming that 'theList' contains a list of numbers, returns the list sorted by increasing values.

StdDate (theDate)
Assuming that 'theDate' contains a valid date, returns the date in short international form : (D)D/(M)M/YY.

tid (theChar)
Just a shortcut, equivalent of the longer:
----------------------------
set AppleScript's text item delimiters to {theChar}
----------------------------

SaveTID ()
This stores the current AppleScript's text item delimiters, for future reset.

stid (theChar)
This sets AppleScript's text item delimiters to the specified value, after having stored the current value for future reset.

ResetTID ()
This resets AppleScript's text item delimiters to the last saved value. By default, ResetTID() sets AppleScript's text item delimiters to the empty string {""}.
Logically, you will use there routines in the following order:
----------------------------
SaveTID, tid, [ tid ], ResetTID
----------------------------
or:
----------------------------
stid, [ tid ], ResetTID
----------------------------

SmileAlias (thePathName)
SmileAlias is exactly similar to the AppleScript's function 'alias' (in other words it will return 'alias thePathName'), except for two things:
- 'SmileAlias' can take a file reference as its argument, while 'alias' cannot.
- 'SmileAlias' does not generate any memory leak, while the standard AppleScript's 'alias' generates a memory leak if the file does not exist (as for AppleScript 1.3.7).

Color constants

For convenience, Smile defines the following constants (they are 'RGB colors', i.e. lists of 3 integers) :

Five grey levels, black , charcoal , grey , mouse and white .
Seven colors, red , green , blue , cyan , magenta , yellow and purple .
----------------------------
set color of paragraph 1 of window 1 to red
----------------------------

Scripting Smile

OpenDictionary (thePathName)
Will open the dictionary of the application whose path is stored in 'thePathName'.

DoOpen (thePathName)
Will open the file whose path is stored in 'thePathName'.

EditObjectScript (theObject)
Will open the script of whatever Smile object whose reference is stored in 'theObject'.

  _ But if you got the effect fro ReÊ Thanx docFCIMMManÿÿÿÿFCIMMManÿÿÿÿ²eÌC ªk, Emmanuel D. Levy. That is the most important. I took Aco 1M. When I was home > at 20:00 I was relaxed and smiling. Ahhhh, no–á    İk¢  Ÿ  İk¢!  3  İk¢f    İk¢#    İk¢  ²  Ôë    Ô  ;  İk¢}    İk¢À  Î  İkÂ¢Ò  á  İk墌  %  İk¢0  ;  İk¢?  ^  İk¢b  |  İk¢‡    İk¢‘     İk¢¤  8  İk¢C  R  İk¢V  e  İk¢i    İk¢)  8  İk¢<  B  İk¢F    İkÂ¢š  ¡  İk¢¥  ´  İk¢¸  ×  Ô     Ô   £  İk¢ ®  µ  İk¢ ¹  Ç  İk¢ Ë  …  İk¢  š  İk¢  ·  İk¢ »  Ê  İk¢ Î  x  İk¢ º  Õ  İk¢    İk¢     İk¢ "  ‡  İk¢ ’   İk¢ ¡  ®  İk¢ ²  !  İk¢,  3  İk¢7  D  İk¢H  v  İk¢z  š  İk¢  Õ  İk¢٠ ù  İk¢    İk¢    İk¢  n  İk¢y    İk¢…  ’  İk¢–    İk¢"  .  İk¢2  8  İk¢<  à  İk墊  '  İk¢+  K  İk¢O  r  İk¢v  —  İk¢›  £  İk¢§  Ç  İkÂ¢Ë  æ  İk墐    İk¢:  H  İk¢L  ]  İk¢a  ô  İk¢ø  K  İk¢O  ü  İk¢>  Q  İk¢a  Ï  İkÂ¢×  í  İk¢ğ  ù  İk¢ı    İk¢    İk¢    İk¢  '  İk¢+  1  İk¢4  =  İk¢A  J  İk¢M  V  İk¢Z  _  İk¢c  u  İk¢x    İk¢ƒ  ‰  İk¢Œ  •  İk¢™  Ÿ  İk¢¢  ª  İk¢®  ´  İk¢·  ¿  İkÂ¢à  É  İkÂ¢Ì  ×  İkÂ¢Û  á  İkÂ¢ä  î  İk¢ò  û  İk¢ş    İk¢    İk¢  5  İk¢9  h  İk¢l  Œ  İk¢Π á  İk¢ô    İk¢    İk¢  u  İk¢€  Š  İk¢  Ÿ  İk¢£  à  İk墑  ÿ  İk¢    İk¢  q  İk¢™  ~selelist long long pbndlist8longxlong.longPlongáBDrwfalspvistrueWIDLfalsICFFlongrSiDlong€ptxfTEXTGenevaptpslong Rectlist8longlonglonglongWTBHlongRqULlongLWdtlongBrWdlongAuAdfalsTbSzlong   _ 0zZstylSOUP&reco2€ÿÿ€ÿÿš‚ `cwtx