{ }
| Syntax |
{ statements } or, { expr, expr... } or, { key: expr, key: expr... }
|
| Action |
Braces have two roles in UserTalk syntax. Their main role is to group program statements into blocks - the statement lists that comprise the body of structured statements like if, case, while, loop, bundle, etc. However, when you edit a script in Frontier's script editor, the outline indentation shows where statement lists begin and end. Frontier automatically inserts braces around these blocks before it compiles the text in the outline, so you rarely need to use braces for statement grouping in the script editor. The other role of braces is to enclose items of lists and records. A list is a series of zero or more expressions separated by commas. A record is a series of "fields" separated by commas, where each field is a key:expression pair. A key is an expression that evaluates to a string4 value.
|
| Examples |
while sys.appIsRunning ("Print Monitor") { sys.systemTask () } This while statement waits until the Print Monitor application is no longer running, indicating that a print job is complete. It could be entered in the Quick Script window, or into an outline heading and executed by typing cmd-/. It would also be valid if typed as a single line in a script, but there it generally would be preferable to enter sys.systemTask () as a second, indented line without the braces. if file.getFileDialog ("Pick a file:", @x, 0) { file.delete (x) } This is a handy, "quick & dirty" type of script to run from an outline heading or the Quick Script window. The file.delete statement might be any file operation that you want to apply to a file. Using file.getFileDialog allows you to pick the file with the standard file dialog instead of having to type out its path. weekDays = {"Mon", "Tue", "Wed", "Thu", "Fri"} timeRec = {'hour': 6, 'min ': 30, 'sec ': 0} These two examples illustrate the use of braces to create a list and a record, respectively. |
| Notes |
Since the Quick Script window has no outline structure, if you enter a script that isn't a simple, straight-line sequence of steps, you must include braces around the program blocks. Many of the examples you see in the documentation assume that you are using the Quick Script window, and include braces where necessary. If you type these scripts into separate headings in a script window, the braces should be omitted.
|
| See Also |
;
|