More Smile commands is the name of the sub-menu which comes installed by default in the User Scripts menu. More Smile commands provides (organized into thematic sub-menus, from File to Programmer) a set of more than 50 miscellaneous tools, most of which were installed upon direct request from users.
We document here this set of additional tools, in alphabetical order.
- All path to
-
A dialog with all the 4-character codes that path to accepts and the full English name of the corresponding folders.
- Balance ⇧⌘E
-
A scripting helper. Works in Text windows and Script windows. Balance will successively attempt to perform the following actions.
-
If the front window's script (not the front window itself) contains a Balance(w) handler, expecting as its single parameter a reference w to the window, Balance will launch that handler. Use this mechanism when you have to use some task with high frequency and for a limited time: programming the task as the Balance(w) handler of the front window's script will map it to the ⇧⌘E keyboard shortcut.
-
If several lines are selected in the front window, Balance will check the parentheses in the lines, and stop at the first anomaly found.
-
If some text is selected, Balance will search it as a verb in the AppleScript dictionaries available. Balance applies the same rules as the Find definition menu item.
If if finds the verb, Balance will write the whole set of parameters for the verb, required or optional. Balance writes variable names of its own only intended for suggesting the type required. For example, Balance will expand the following verb:
display dialog
into:
display dialog MyString default answer MyString buttons MyList default button MyNumber with icon MyNumber with icon MyStop giving up after MyInteger
This works for verbs belonging to a dictionary, and also for commands belonging to an AppleScript library (provided the library was indexed, which is the case for the built-in libraries). For example, Balance will expand the following command:
CirclePath
into:
CirclePath(the_center, the_radius)
-
If no text was selected, or if the selected text was not found in any dictionary nor any library, then Balance will check that parentheses, brackets, braces and double-quotes are balanced. If some balancing error is detected, it will highlight the character where the error was detected. If some pair(s) are not closed, Balance will close them. In which case, it will highlight the characters that it added, so that you can check its action. For example, Balance will make:
[…] & (item i of {"foo", "bar
into:
[…] & (item i of {"foo", "bar"})
-
If no problem was found with parentheses, Balance will try to close a wrapping structure. For instance, Balance will expand:
if (someCondition)
into:
if (someCondition) then
| (<-- insertion point here)
else
end if
Balance handles the following AppleScript wrappers: tell, on [handler], to [handler], repeat, if, script, try, with timeout, all considering's, and all ignoring's. If you trigger Balance after a tell, it will present a dialog to let you choose any of the scriptable applications available and it will then complete the tell line for you.
- Close without saving ⇧⌘W
-
Dismisses the active window without saving its contents. Use with caution!
If you have installed the XFun osax, ⇧⌘W will display a cloud of smoke.
- Comparator
-
A tool (a Smile dialog) to synchronize two windows.
-
When you open Comparator, it assumes that you want to synchronize the two frontmost windows, and it loads those windows, provided they are text, Unicode or script windows (to prevent Comparator from loading the two frontmost windows when it opens, hold the ctrl key). Loading the windows consists in placing them side to side: then Comparator knows the windows as the left window and the right window.
-
The windows will recover their original location when Comparator releases them, including when you close the dialog.
-
To find the first difference, then the next ones, click Find next difference.
-
To synchronize a given difference, use the arrow buttons → (copy from the left window to the right window) and ← (from the right window to the left window).
-
To colorize the differences, use the Mark differences menus (works only in AppleScript terminals). Colorizing the differences is convenient when you must synchronize multiple sources.
- Copy Finder's Selection's Posix
-
Prints into the active window the POSIX path(s) of the file(s) currently selected in Finder. If several files are selected, their paths are separated with CR (ASCII 13).
- Copy Smile URL to clipboard
-
Converts the selected text, or the content of the front window if no text is selected, into a URL from the smile scheme, and copies the URL to the clipboard (the original text remains unchanged). The URL once installed in a mail or in an html page for instance, and then clicked by the user, will import the original text into Smile.
The information about the smile URL scheme is provided in the pages about the customization of Smile's help system.
- Copy Style ⇧⌘C and Paste Style ⇧⌘V
-
Copy and paste the style and color of text. The contents of the standard clipboard is not affected. Copy Style and Paste Style work on the selected text in a text window and in the selected dialog items in a dialog, provided the dialog is in edit mode.
- Decimal to Hexa ⇧⌘H
-
Converts a positive integer written in decimal format, for example 10000000000, into its hexadecimal representation, here 02 540B E400. The hexadecimal digits are separated by spaces into 4-characters blocks.
The input string may contain spaces, e.g. 10 000 000 000. You can convert integers up to 281474976710655 (hexa: FFFF FFFF FFFF).
- Delete file
-
Moves to the trash the document which is opened in the active window. Hold down the ctrl key to skip the confirmation alert.
- Duplicate file
-
Duplicates in the same directory the document which is opened in the active window. You are prompted for a new name.
- Duplicate ⌘D
-
Duplicates the selected text. Same as the sequence Copy Paste Paste (⌘C ⌘V ⌘V) but preserves the contents of the clipboard.
If no text is selected, Duplicate duplicates the active window. If the active window is the window of a document open in Smile, the document is not duplicated. To duplicate the file use Duplicate file instead.
- encode-decode64
-
Converts the selected string into base64. base64 is a format which uses a very reduced set of characters, suitable to transfer data with minimal risks of data corruption. Select encode-decode64 with the ctrl key pressed to perform the inverse conversion from base64 back to string.
encode-decode64 performs a standard, untyped, conversion. The encode64 and decode64 verbs of the dictionary allow a more sophisticated, AppleScript-aware usage.
- EZOpener
-
Opens a dialog with an auto-completing text entry field for files and a menu which offers several actions to perform regarding files (default action: Open). Includes a Load window 2 button. Convenient when your manipulate a great number of scripts or of text documents: you open files without switching to Finder.
- Font dialog
-
A tool (a Smile dialog) to provide the list of the Unicode fonts available on your machine. Shows a sample of the fonts. You use the Unicode fonts in Unicode windows and in graphic windows (for instance when you use the DrawText or DrawString commands).
- Get error information
-
Provides (if available) the information about an AppleScript or an OS error, given its error number.
- Hexa to Decimal ⇧⌘X
-
Converts a number written in hexadecimal format into its decimal representation.
The input string may contain spaces and CR (ASCII 13) characters, for instance 02 540B E400. You can convert numbers up to FFFF FFFF FFFF.
- Hexa to String ⇧⌘G
-
Converts a string of hexadecimal digits, for instance 68 65 6C 6C 6F 21, into characters, e.g. hello!, using AppleScript's ASCII table, in other terms the Mac-Roman ASCII encoding.
The input string must contain an even number of hexadecimal digits. It may include spaces and CR (ASCII 13) and be of any length.
- HexaDeciText
-
A tool (a Smile dialog) which displays simultaneously the hexadecimal, decimal, text and binary representations of the data entered. You may enter data under any of those forms. HexaDeciText displays a question mark ? when it cannot perform the conversion.
- Install libs browser
-
Installs menus in the current window to help working with libraries, which can emit palettes.
- ISO-Latin1->Mac and Mac->ISO-Latin1
-
Perform the encoding conversions of the text selected in the frontmost window. If no text is selected, the conversion applies to the whole text.
ISO-Latin1 (ISO-8859-1) is the encoding used traditionally by Microsoft. For instance when you see ì and î instead of smart quotes, you are reading a document encoded as ISO-8859-1.
- Javascript Terminal
-
A window which works like an AppleScript Terminal, where you can write javascript and execute it (line by line or by block, using ⌘R) in a web window or in Safari. Useful to debug javascript.
- Mac->ISO-Latin1
-
See ISO-Latin1->Mac.
- Make an AppleScript String ⌘"
-
Adds double quotes around the text currently selected, performing all necessary changes to make the text into a correct AppleScript string. For instance Make an AppleScript string makes:
set s to "say \"hello\""
into:
"set s to \"say \\\"hello\\\"\""
Selecting Make an AppleScript string with the ctrl key pressed has the inverse effect.
- Make stand-alone application
-
Bundles the front dialog into a stand-alone application. The chapter in this site about Smile's custom dialogs presents many options such as having your application open files of a given type, or providing html help pages in the Help menu.
- Man Page
-
Ask for a shell command, and display its man page.
- Measure Text ⇧⌘T
-
A tool (a Smile dialog) to display continuously the number of characters, words, and paragraphs in the active window and in the selected text. Hamish Sanderson brought significant improvements.
- Object eXpert ⇧⌘I
-
A tool (a Smile dialog) to view and edit all the properties of any object in Smile. Object eXpert shows more properties than dragging an object (such as a control in a dialog) onto a text window. If you check more properties, the dialog shows still more properties, including properties that may require some caution.
The Object eXpert's input field supports any AppleScript expression. For instance if you are editing the bounds of a window the input field will support an expression such as the following.
{130-50, 168, 580+50, 668}
In the select some object group of Object eXpert, you can enter any valid AppleScript descriptor for the object you want to edit, such as window "Data" or curve 1 of item 1 of window 2. As soon as the field recognizes a valid reference it will replace your entry with the canonical descriptor of the object, for instance curve id 244 of plot view id 37 of graphic window id 44. This makes it difficult to enter a description such as, for example, window 12. If you are in trouble, Paste from a text window into the object description field.
- Open huge file
-
Opens a dialog that allows viewing and searching (as ASCII) arbitrarily large files.
- Open ISO-Latin1
-
Opens a text document using the ISO-8859-1 encoding. Microsoft applications generally save .txt files as ISO-8859-1.
A document that you open with Open ISO-Latin1 will keep the ISO-8859-1 encoding when you save it. Next time you open the document, you must still use the Open ISO-Latin1 command.
- Paste Style ⇧⌘V
-
See Copy Style ⇧⌘C.
- Property & class to raw code
-
Works on the selected text, which should be either a property or a class name of AppleScript or of Smile. Replaces the selected text with its raw code equivalent. For instance Property & class to raw code will make:
file specification
into:
«class fss »
- Rename file
-
Renames the active window. You are prompted for a new name. If the active window is the window of some document open in Smile, the file is renamed accordingly.
- Revert file
-
Closes the active window without saving changes and reopens the document as it was last saved on disk. Hold down the ctrl key to suppress the confirmation alert. Revert file is really a shortcut for closing the active window without saving changes and then re-opening it. Use it, for instance, to test a prepare handler or to re-open a file which is open but that you have just changed (on disk) by script.
- Save a copy
-
Saves a copy of the active window as a new file.
- Save all
-
Saves all text windows, Unicode windows and script windows which have been modified since they were last saved, and prints the list of the windows that were saved to the Console.
To print the list of the modified windows to the Console without saving them select Save all with the ctrl key pressed.
- Scale Dialog
-
a command which resizes the whole dialog. You provide any real number (or an expression evaluating to a real number) as the scaling factor: {\src 1.0} means no change.
- Send to back ⇧⌘B
-
Sends the active window behind all others. By pressing repeatedly ⇧⌘B you can view successively all the open windows.
- Set type and creator
-
A tool (a Smile dialog) for setting quickly the type and creator of one file or of a set of files, or for reading the type and creator of a given file. To suppress the file type select (none) in the menu.
- Shelp
-
A tool to help scripting the Unix shell with do shell script. The text field is like a small Unix Terminal window. Special buttons provide quick access to apropos and man. The man's print in a text window, that you can then use, save, and handle like any regular text window.
- Sort paragraphs
-
Sorts alphabetically the paragraphs of the selected text of the frontmost text or script window. If no text is selected, the sort applies to the whole text.
To have the paragraphs sorted in the reverse alphabetical order, press ctrl while selecting Sort paragraphs.
- String to Hexa ⇧⌘J
-
Converts a string of any length, e.g. ascr, into its hexadecimal representation, e.g. 61736372, using AppleScript's ASCII table, in other terms the Mac-Roman ASCII encoding.
- Transform text
-
A tool (a Smile dialog) which gathers several useful utilities on text. A menu lets you select any of the following commands: all uppercase, all lowercase, capitalize words, fix line wraps, iso-8859-1 to mac, mac to iso-8859-1, or zap LF's
- Zap LF's
-
Changes all the CR (carriage return, ASCII 13, key ↩) into LF (line feed, ASCII 10) in the front window. Changes also CR+LF and LF+CR into LF.
Press the ctrl key for the reverse action, that is to make all new lines into CR.
|