HX du2|Cӝ[bnZu a Ň  JX appleEventnt.newRecordwizeStringring3 CJ .x߬ z)b=P ]/ V=identifier1 . identifier2 expression1 != expression2 expression1 notequals expression2V3'> >= <= == ty operator yields the boolean value tr3<{ }statement1; statement2;b_:;BPݚݚLANDLANDb+ - * %tThe arithmetic division operator yields the result of dividing the value of expression1 by the value of expression2.texpression1 / expression2/2As illustrated in the third example above, a dotted-ID pair can be used as the identifier for the table in another dotted-ID pair. The full database path to an item is a series of dotted-IDs, starting with the root table. (Though, for brevity, the root table itself can be and often is omitted.)on=.2 @ = [ ]<= ==4O(% z+ / bFr637ݚݚLANDLANDb " "8$sQN^w8B]Bm "characters" or, charactersӉ UCreates a string value containing the character sequence between the matching quotes.U"System:Frontier 1.0:" System:Frontier 1.0: File system paths are just string values. clock.now () clock.now () Since clock.now () is within a pair of quotes, the verb is not called; it is just like any other character sequence, with no special behavior. He said "scripting is fun!" He said "scripting is fun!" This example illustrates how one style of quotes can be used to contain the other.As shown in the last example, a strings characters can include the type of quotes that are not being used to enclose the characters; straight quotes can enclose curly quotes, and vice-versa. string5*uXPk]v4Ok| bi"IݚݚLANDLANDb %Qj}*_q!XLh-lAk expression1 % expression2p,Z xThe arithmetic modulus operator yields the remainder when dividing the value of expression1 by the value of expression2.x10 % 4 2 Four goes two times into 10, leaving a remainder of two. 10 % 4.0 This statement generates an error; the modulus operator does not work on floating point values, since the result of floating point division is not truncated and thus has no remainder. long (clock.now () % 3600) 2566 This expression yields the number of seconds into the current hour we are right now.| Only integral-compatible types short, long, date, etc. can be used in the modulus operation. UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions of the modulus operation need not be of the same type. Generally, the resulting type is the more complex type, the one that can most readily represent both values.| + - * / mod5!m`Aq O܀?P b+W DݚݚLANDLANDb ( )9ΆMiDj}12Vҏ *identifier (expression1, ..., expressionN)*IInvokes the script named by identifier, passing the values resulting from expression1 through expressionN as parameters. The number of parameter provided must match the number expected by the script, as defined in its on statement script header. The value returned by the script becomes the value of the script call expression.Iclock.now () 11/11/91; 7:51 PM Here were calling the built-in verb clock.now; the result of the call is the value returned by the verb. Note that the parenthesis notation must be used to indicate that we are making a call to the verb, even though it takes no parameters. on addThree (n1, n2, n3) { return (n1 + n2 + n3)}; total = addThree (1, 2, 3) 6 This example illustrates the correspondence between the parameter list provided when calling a script and the parameter declaration in the scripts defining on statement.~Forgetting to provide an empty pair of parentheses when no parameters are required is a common scripting error watch for it.~ onېΗKL?&Rr'_R6A bn $ݚݚLANDLANDb *}f~ L`dJ&& yr^ expression1 * expression2l+l gThe arithmetic multiplication operator yields the product of the values of expression1 and expression2.g3 * 0.5 1.5 The number 3 is promoted to a double, the type of 0.5, in order to perform the multiplication. "abc" * "def" This statement generates an error; only numbers can be used as multiplication operands.y UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type to be multiplied together. Generally, the resulting type is the more complex type, the one that can most readily represent both values. Only numeric-compatible types short, long, single, double, date, etc. can be multiplied.y + - / %rcrakeads)s) b ! !}"c#'ݚݚLANDLANDb +Ϛwt9K[+kh0 )D8wq(; expression1 + expression2c Q ]The arithmetic addition operator yields the sum of the values of expression1 and expression2.]1 + 1 2 UserTalk can add one and one with great facility! "one" + "one" oneone The addition operator can be used to concatenate strings. 3 + "k bytes needed." 3k bytes needed.?UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type to be added together. Generally, the resulting type which determines the method of addition is the more complex type, the one that can most readily represent both values.? - * / % =\m p%9TR2!PX b$$$%C& 'T,MݚݚLANDLANDb ++D@pY,(&YX("+PO* ++identifier identifier++kO!` WThe increment operator adds the numeric value 1 to the value of identifier. In the first case, where the increment operator appears before identifier, the value of the increment expression is the value of identifier after it is incremented. That is, the increment operation takes place first, and the result is used as the value of the expression. In the second case, where the increment operator appears after identifier, the value of the increment expression is the value of identifier before it is incremented; the increment operation takes place after the expressions value has been determined.Wx = 3; ++x 4 Since x is pre-incremented, its final value of 4 is the result of the expression. x = 3; x++ 3 In this case, x is post-incremented, and the result of the expression is its value before 1 is added to it. Its value after the statement is executed is still 4.HAny type that supports addition can be used with the increment operator.H + --vM@c%\u1WM] b'((F*+,!0ݚݚLANDLANDb -W1Փl&*뮤<.0cp1# expression1 expression2 5U gThe arithmetic subtraction operator yields the difference of the values of expression1 and expression2.g3 0.5 2.5 The number 3 is promoted to a double, the type of 0.5, in order to perform the subtraction. "workfile.backup" ".backup" workfile The subtraction operator works with strings; the result is the removal of the first occurrence of the second string from the first string. "abc" "def" abc The second string does not appear in the first, so nothing is removed. UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type to be subtracted. Generally, the resulting type which determines the method of subtraction is the more complex type, the one that can most readily represent both values. The minus operator can also appear before a single operand to indicate arithmetic negation. + * / %B)fPXbSq >= < == -2' tc/FXN5 bFUFFG\H9JOʩݚݚLANDLANDb =Spkqrb qۛѱIJ identifier = expression.M&Vz CEvaluates expression and assigns the resulting value to identifier.Clocal (x); x = 3 * 4 12 The assignment statement causes the value of the expression 3 * 4 to be stored in the local variable x. scratchpad.when = clock.now () 11/11/91; 7:36 PM In this case the expression clock.now () yielded a date value, which was then assigned to the cell named when in the table named scratchpad. (The when cell need not have already existed.) local (x); x = scratchpad.when 11/11/91; 7:36 PM In this case, we copy a value out of the object database and store it in a local variable. The identifier need not specify an existing database cell; the assignment statement will create an item with the given name in the specified table. If no table is specified, a new local variable is created in the code block where a local statement or a local script definition was most recently encountered. While assigning values to variables without declaring them can be a timesaver, it is generally bad practice; as a script becomes more complex, it quickly becomes easy to unintentionally modify a variable in an enclosing scope level. local == db.get db.setqzu[} bJJKKWMrOSxݚݚLANDLANDb ==~"9yq;* 9expression1 == expression2 expression1 equals expression29zThe equality operator yields the boolean value true if the value of expression1 and the value of expression2 are the same.zfile.type ("myFile") equals 'TEXT' true This expression evaluates to true if file.type returns TEXT as its result. 27 == "27" true When coerced to be of the same type, the two representations of the number 27 are equal, and the result of the operation is true. There is no difference between the two forms, == and equals. UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type for their values to be equal. > < >= <= =ǁ0ûO+ɞa4 bP8PdPQ/ROSLWmݚݚLANDLANDb >@LHO jdPH({+F =expression1 > expression2 expression1 greaterthan expression2=This comparison operator yields the boolean value true if the value of expression1 is greater (larger) than the value of expression2.file.size ("myFile") > 1000000 true This expression evaluates to true if file.size returns a value larger than one million. "abdc" > "a" true There is no difference between the two forms, < and greaterthan. String comparison is carried out according to the ASCII sequence; this yields alphabetical results, but lowercase characters sort after all uppercase characters, that is, A < Z < a < z. UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type to be compared. < >= <= == O8 .))B bSTT[TUWA[ݩݚݚLANDLANDb >=S' AS& GR Ƥl 4expression1 >= expression2 expression1 expression24This comparison operator yields the boolean value true if the value of expression1 is greater (larger) than or equal to the value of expression2.file.size ("myFile") >= 1000000 true This expression evaluates to true if file.size returns a value larger than or equal to one million. "abc" "abc" true The result is true, because the two expressions are equal. There is no difference between the two forms, <= and . String comparison is carried out according to the ASCII sequence. This yields alphabetical results. Lowercase characters sort after all uppercase characters, that is, A < Z < a < z. UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type to be compared. The symbol can be entered at the keyboard with Option> > < <= == tvǘ7mO`} p bWXXGXY[cJݚݚLANDLANDb @#_M~_9jgB?j @identifier8y՟KFh> Takes the address of identifier. The address can be used with the dereference operator (^) to refer back to the original object specified by identifier. Addresses provide a way to refer to Object Database cells rather than their contents. A script that takes the address of an object as a parameter can change the contents of that database location, while a script that takes an objects value as a parameter works only with a copy of that value.name = ""; if dialog.ask ("What's your name?", @name) {msg (name)} The built-in verb dialog.ask takes the address of a string as its second parameter. When passed the address of the local variable name, dialog.ask is able to change its value. saying = "A bird in the hand is worth two in the bush"; string.countWords (saying) In this case, the built-in verb string.countWords doesnt need to be able to change the original string; it just wants to work with its value. Therefore, we dont use the address operator. adr = @people [user.initials].notepad if not defined (adr^) new (outlineType, adr) This advanced example shows how the dereference operator works in tandem with the address operator. First, we put the address of the location where the users notepad outline usually exists into the variable adr. We then check to see if the object at that address is defined that is, if it actually exists. If not, we create an outline there using the new verb, which takes the database address as its second parameter.Strings that name database cells can be coerced to addresses with the address verb. So the value of address (system.verbs) is equal to @system.verbs. ^ [ ] address local onGJ* b\K\w\^mb{csiݚݚLANDLANDb [ ]]>/(/7倴`-Js )[expression] or, identifier [expression])These two forms of the bracket operator have very different meanings. In the first form above, expression is evaluated as a string, and the result is then treated as an identifier. Identifiers are the names of objects in the database and in scripts, which normally must consist strictly of alphanumeric characters (and possibly underscores). The bracket operator allows strings that contain spaces or other special characters to be used as identifiers. It also allows a simple identifier to be replaced by a calculation of any kind. The second form above is referred to as an array operation. In this case, identifier must specify a table, list, record, string or binary value, and expression specifies an item in that value. For tables and records, the item may be specified either by index (a number) or by name (a string). For other value types, the item must be specified by index. The first item in an array has an index of one.edit (@examples. ["Sample Outline 1"]) true Sample Outline 1 contains spaces, and would normally be interpreted as two identifiers followed by a number a syntax error, since its not a valid expression. So we enclose the name in quotes, which groups the entire sequence of characters into a single string value. The bracket operator then causes the string value to be treated as an identifier, allowing it to become part of the dotted id specifying the outline object. sizeOf (people.[user.initials].notepad) 65 This example demonstrates how the bracket operator allow you to substitute an expression for an identifier. First, the expression user.initials is evaluated. The resulting value is used to name an item in the people table, the one belonging to the current user. Finally, the item named notepad is referenced in the table specified by people.[user.initials]. The result indicates that the outline contains 65 headings. defined (["system.verbs"]) false At first this can seem puzzling; there is a table named verbs in the system table. However, thats not what this expression specifies. The string "system.verbs", enclosed in the brackets, is interpreted as a single identifier, so the expression specifies an object whose name is "system.verbs". No such object exists. When you want to interpret a string as a dotted path rather than an single identifier, use the address verb to coerce the value to an address. nameOf (examples [5]) counter Here, were using brackets as an array operation; note that there is no dot between examples and the first bracket. The simple expression 5 indicates the fifth item in the table. The nameOf operator returns the name of that item. x = {Jan, Feb, Mar}; return (x [2]) "Feb" x = abcdef; return (x [6]) 'f' x = binary (abcdef); return (x [1]) 97 These examples show how you can use brackets to access an item in a list, a string, and a binary value respectively, treating the value as an array. The type of the item value depends on the type of the array value; an item in a string is a character, while an item in a binary value is an unsigned byte represented by an integer value. When expression is a string and the array value is a table, there is no functional difference between using the string in an array operation and using it as a bracketed identifier in a dotted id. That is: identifier [expression] identifier.[expression] both specify the table item whose name matches the result of expression. In addition to the requirement that identifiers contain only alphanumeric characters and underscores, they must not begin with a number, and cannot be the same as a reserved word of the UserTalk language. So if you need to create or refer to an object named while, the bracket operator must be used as shown in the first example above to prevent the name from being mistaken as a looping statement. . @ = { } sizeOf nameOf address bccdgpUs=z ݚݚLANDLANDb ^d_ZE5;Єs#:lsܽ expression^9dxȪZォ l The dereference operator refers to an object specified by a database address. It evaluates expression, interprets the result as the address of an Object Database cell, and yields the value of that cell.local (addr = @examples.age); x = addr^ 46 This simple example shows how the dereference operator extracts the value of the address, in this case the address of the age cell in the examples table. on triple (addrN) addrN^ = addrN^ * 3 triple (@examples.age) Type this script into a script window. In this example, the local script triple multiplies by three the value whose address is passed to it. The example below demonstrates a more straightforward method of accomplishing the same thing, but it is interesting see how the @ and ^ operators work together here. on triple (n) return (n * 3) examples.age = triple (examples.age) typeOf (window.frontmost ()^) == tableType true Here, the value returned by window.frontmost a string is treated as a database address, and the type of the value at that address is compared to tableType. If the frontmost window contains a table, the result of the expression will be true.The technique shown in the second example above is generally advisable only when working with large pieces of data that reside in the database, such as binary values, in which case memory overhead may be reduced. Otherwise, the simpler approach of example #3 is preferable. @/c-^1 h[s_lߝqv! c bstt/uxy|mݚݚLANDLANDb abs{vؾTntI T@ abs (number)s.Vsj 9number is a number whose absolute value you wish to find.9lCalculates the absolute value of number, where absolute value is defined as number without any leading sign.l The absolute value of number.%C{ 1abs (43) 43 abs (43) 43 abs (-3.2) 3.21lnumber can be any of the following types: charType, intType, longType, singleType, doubleType, or fixedType.lbzwzz{{{{EݚݚLANDLANDb address ~mE=IYj_ address (value)#ʳÎ7eE evalue is the object whose datatype you wish to coerce to be a valid Frontier Object Database address.eYCoerces the string into an address intended to be used with the Frontier Object Database.YThe address value if the coercion is successful (that is, the string was successfully converted to a form that can be used to address the Frontier Object database.) This is not a guarantee, however, that the address exists in the database.address ("examples.readMe") @examples.readMe address ("people.XYZ") @people.XYZ even though there is no such table entry at this time address ("examples.age")^ 36 adr = address ("examples.foo"); msg (adr^) This example produces an error message for the second statement because foo has not yet been defined. If we had not included the second statement, Frontier would have returned @examples.foo, as described above. if dialog.ask ("Address of cell to edit?", @s) {edit (address (s))} Here we prompt the user to give us a cell address. The value returned by dialog.ask is a string, so we have to coerce it to an address that the edit verb will understand.If you supply a number or some other type of data that Frontier could interpret as a string but which does not equate to a meaningful address, Frontier returns Cant coerce the value to an address. This is a seldomused verb. Generally you will use the @ operator to reference an objects address. This verb is only needed when you have a value you wish to coerce into being an address. Although the address verb will take any datatype as an argument, it will almost always make sense only when used with a string that can be resolved into an address in the Frontier Object Database. defined[q!Rii׷C1|O; b|}}3}~ ݚݚLANDLANDb aliasdZePUic~~$Gz+ alias (path)3<ȗO.@9q~ $path is a valid file path reference.$+Coerces a file path to an alias type value.+2The alias value corresponding to the file at path.2Dalias ("System:System Folder:Finder") System:System Folder:FinderDThe alias verb is useful when communicating with an application that expects an alias value as a parameter. The Frontier verb file.newAlias creates an alias file, a special Macintosh file type that contains an alias to another file (or to a folder or volume). This verb, on the other hand, creates an alias data structure that can be used by a receiving application in an IAC situation. file.newAliasyx|0X/P( b ;rwݚݚLANDLANDb andZ}r&ÓMexGA 6expression1 and expression2 expression1 && expression26The logical conjunction (boolean and) operator, yields the boolean value true if both expression1 and expression2 evaluate to true, false otherwise.Afile.exists ("myFile") and (!file.exists ("myFile")) false This expression always evaluates to false, because it is impossible for both expressions to be true at the same time. file.exists ("myFile") and (file.type ("myFile") == 'TEXT') true This expression evaluates to true if myFile exists and is a text file.A There is no difference between the two forms, && and and. UserTalk employs short-circuit evaluation of boolean expressions. In other words, if expression1 of an and operation evaluates to false, expression2 will not be evaluated, since it can already be determined that the result of the operation will be false. In example #2 above, the call to file.type will never be made if file.exists returns false (i.e., the file doesnt exist). or not%.6=+*nzy+ b)U9KbݚݚLANDLANDb appleEvent(Yx# o9f% HappleEvent (appID, verbClass, verbID [, key1, value1 [, keyN, valueN]])HzappID is a value identifying the application to which this verb is addressed. It can be a string4 containing the application signature, a binary value obtained by calling sys.browseNetwork or a string containing the application name or network address. The address of a binary code value may also be supplied (see Notes). verbClass is a string4 indicating the Apple event verb class. verbID is a string4 indicating the Apple event verb ID. key1 is a string4 indicating the keyword for the first parameter value. value1 is the first parameter value, and can be any type. [keyN, valueN] are additional keyword and parameter value pairs.zSends an Apple event of the indicated class and ID to the application identified by appID, one parameter for each keyN, valueN pair provided, and waits for a reply.QThe value contained in the reply from the application. The value can be any type.QappleEvent ('BARC', 'app1', 'cwin') true BarChart is running and closed its active window appleEvent ('BARC', 'app1', 'nwin', '----', "Disk Space Chart") true BarChart created a new window with the given namexIf the application indicated by appID is not running, or doesnt know how to handle the given verb, an error will occur.xm Any number of key, value parameter pairs may be provided, including zero (none). Any key, value pair can be replaced by a table name. The values in the table will be included in the event, with the item names as the parameter keys. The item names must all be four characters long. In Frontier 3.0, a key, value pair can be replaced by a record value. The values in the record will be included in the event, with the record keys as the parameter keys. The type of each parameter value determines the corresponding descriptor type in the outgoing Apple event. For all non-binary values, the descriptor type will be typeOf (value). For a binary value, the descriptor type will be getBinaryType (value). Thus, if you need to send a value with a different descriptor type than Frontiers default, you can coerce the value to a binary value, and then use setBinaryType to specify the desired type. The descriptor type in the result determines the type of the result value. If it corresponds to one of Frontiers built-in types, a value of that type is returned. Otherwise, a binary value is returned, with its binaryType set to the descriptor type. If more than one return value is desired, use complexEvent. In addition to sending Apple Events to other applications, this verb can be used to call a UCMD or OSA Script by passing the objects database address as the appID parameter.m}complexEvent finderEvent tableEvent setBinaryType sys.browseNetwork setEventInteraction setEventTimeOut setEventTransactionID}be`ݚݚLANDLANDb beginsWithbxtLz Fh ?j "expression1 beginsWith expression2"Evaluates both expressions as strings, and determines whether the result of expression1 begins with the result of expression2. If expression1 produces a list, expression2 is evaluated as a list and the comparison is done on a list basis rather than as strings."The quick brown fox" beginsWith "The" true string.lower (file.fileFromPath (f)) beginsWith "temp" true The expression would return true for files named tempfile, Temporary Data, temp, etc. 1234 beginsWith 12 true The numbers are converted to strings for this operation. {1, 2, 3} beginsWith {1, 2} true This is an example of applying the beginsWith operator to a list. {1, 2, 3} beginsWith 1 true The number 1 is converted to a list for this comparison.^The beginsWith operator is case-sensitive; upper-case characters do not match lower-case ones.^%contains endsWith string.patternMatch%b*:%gݚݚLANDLANDb binary3^3q2! ])m~c7 binary (value)x/3]-? ?value is the object you wish to coerce to be a binary datatype.?#Coerces value to be a binary value.#,A binary representation of the data in value,binary (23) 0x00000017 the binary representation of decimal 23 binary ('a') 0x61 ASCII value for the character "a" binary ('abcd') using a value of datatype str4 0x61626364 ASCII values for 'a' (61), 'b' (62), 'c' (63), 'd' (64) binary ("What?") 0x576861743F binary value for the string binary (true) 0x0001 binary value for the short integer "1," which is True in Frontier binary (infinity) 0x7FFFFFFF<The binaryType of the binary value is set to typeOf (value).< getBinaryType setBinaryTypeEk b.Z8; ݚݚLANDLANDb boolean44pk;0Δf\pL boolean (value)w]YYKNj Bvalue is the object whose datatype you wish to convert to boolean.B:Converts value to be a boolean datatype value if possible.:9boolean value of true or false if coercion is successful.9boolean (0) false 0 is always false boolean (1) true 1 is always true boolean (235) true Any non-zero value is always true boolean ("Hello") true Any nonempty string is true boolean ("") false An empty string is falseb-{ݚݚLANDLANDb breakUc`d32̊P1 7 break{+_"jVy3^Uf1e Terminates the innermost for, loop, fileloop, or while statement in which it is contained. Script execution continues at the next statement following the looping construct, skipping any subsequent statements within the current loop body.lfileloop (fName in folderPath) if file.isLocked (fName) lockedFileFound = true break ++numberOfFiles if lockedFileFound msg ("Found a locked file.") This is just a script fragment, so dont attempt to execute it. A loop like the one above might be used to count the number of files in a folder about to be deleted, so that a confirmation dialog could be presented to the user. However, since a locked file was found, the folder cannot be deleted, and the loop is terminated early. loop if not dialog.ask ("What number am I thinking of?", @x) return (false) if x == 16396 break msg ("Try again!") This is just a script fragment, so dont attempt to execute it. This loop prompts the user for a number forever, until he or she exhibits astonishing clairvoyance or gets sick of the game. The break statement allows the loop to be terminated if the user gets lucky.lThe break statement only terminates the loop that contains it; loops outside of the innermost loop continue to execute as usual. for fileloop loop while continue bxAݚݚLANDLANDb bundle86VL` bundle statementsHOkr%ѭG Executes statements once. IG2OXI bundle set up the object database for a new run app.clearNetworkApp () Frontier.pathstring = file.getPath () menu.currentsuite = "" modes.currentmenu = 0 Type this script into a script window. In this example, a fragment of Frontiers standard startup script, the bundle statement serves purely as an encapsulation mechanism. The four statements in the bundle are executed exactly as if they appeared in line, outside of the bundle. The bundle statement provides additional structure to the script so that the statements can be expanded and collapsed together, and have a single comment that describes their combined action. bundle make sure the user has a notepad outline local (notepad = @peopletable^.notepad) if not defined (notepad^) new (outlineType, notepad) Type this script into a script window. This example, taken from Frontiers user.login script, illustrates an additional encapsulation property of the bundle statement. By declaring the notepad local variable within the bundle, its scope is only over those statements that actually work with it. As in the first example, the bundle statement can be collapsed leaving just its comment visible. on local @ ^3a~'lV8JĬ! bgbݚݚLANDLANDb callXCMD̆#:Q=XaxYѭX ,callXCMD (addrXCMD [, value1 [..., valueN]]),addrXCMD is the address of a binary value containing the XCMD or XFCN code. value1 through valueN are string parameters to be passed to the XCMD. Up to 16 parameters values may be provided, or none at all.pexecutes the XCMD or XFCN code stored in the binary value at addrXCMD, passing it the parameter values provided.pThe string value returned by the XCMD. If the code at addrXCMD is an XCMD, and it doesn't return a value, callXCMD returns true. If the code at addrXCMD is an XFCN, and it doesn't return a value, callXCMD returns the empty string.callXCMD (@syslargestblock.code) 1310K callXCMD (@ARA.hyperConnect, "System:Utilities:ARA Login", false) The Modem Port is currently in use by Navigator 3.1.1. an error occurred The binaryType of the value at addrXCMD must be either 'XCMD' or 'XFCN'. Frontier supports the following standard XCMD callbacks: EvalExpr SendCardMessage SendHCMessage GetGlobal SetGlobal ZeroBytes ScanToReturn ScanToZero StringEqual StringLength StringMatch ZeroTermHandle BoolToStr ExtToStr LongToStr NumToHex NumToStr PasToZero PointToStr RectToStr ReturnToPas StrToBool StrToExt StrToLong StrToNum StrToPoint StrToRect ZeroToPas SendHCEvent These represent all of the HyperTalk Utilities except for RunHandler, and all of the String Utilities and String Conversions. In addition, the HyperCard 2.0 SendHCEvent callback is supported. When using EvalExpr, SendCardMessage, or SendHCMessage, the message or expression must be a valid UserTalk script. All three of these callbacks execute the script; only EvalExpr returns the result. When getting or setting a global, any value in the current scripts scope can be named. If SetGlobal is called with a name that isnt defined and isnt a dotted database path, the value is placed in the scratchpad table. If GetGlobal is called with a name that isnt defined, an error is returned. appleEvent launch.resource[ b%Qb6ɩݚ©ݚLANDLANDb caseo6#`(v { bzն _case expression expr1 statements1 expr2 statements2 exprN statementsN else statements_uEvaluates the case expression, and then evaluates item expressions 1 through N in succession until one of the resulting values matches that of the case expression. When a matching value is found, the corresponding statements are executed, and the case statement is exited. The statements under each case item expression are optional; if they are omitted, then the next statement list that appears in the case body is associated with that item. The else clause of the case statement is optional. If it is provided, and none of the item expressions in the main case body match the case expression, the else statements are executed.ucase dialog.yesNoCancel ("Save changes before quitting?") 1 msg ("Your changes are being saved") fileMenu.save () 2 msg ("Your changes are being discarded") 3 msg ("Ok, we wont quit") return (false) dont continue process fileMenu.quit () Type this script into a script window. In this example, dialog.yesNoCancel is known to return a result of 1, 2 or 3. The case statement allows the appropriate action to be taken for each response. case user.initials "DW" msg ("Hi Dave!") "dmb" msg ("Yo Doug!") else msg ("Howdy stranger.") Type this script into a script window. This example demonstrates the use of the else clause, and also illustrates a feature of the case statement that is unlike most other languages: the case expression and the item expressions can work with values of any type. case itemhit 1 user clicked OK copyfromdialog () return (false) 2 user clicked Cancel return (false) 3 5 checkboxhit (itemhit) 6 7 8 radiobuttonhit (itemhit) This is just a script fragment, so dont attempt to execute it. It shows how the same statements can be shared by several item expressions by listing them in sequence and including the statements only under the last item. The item expressions do not have to be simple constants; they may be complex expressions if desired. Once an item expressions value matches that of the case expression, none of the subsequent expression are evaluated. if+\RP'.DbM/؁ bg]ݚéݚLANDLANDb charbb{X5ZtNˮ? char (value)iFQro,p Hvalue is the object whose datatype you wish to coerce to be a character.H7Coerces the datatype of value to be char if possible.7 A character value.@;C 7F [char (65) A 65 is the ASCII equivalent for A. char ('a') a No coercion is necessary; value is already of the right datatype. for i=33 to 255 {msg (char (i))} true Cycles through all ASCII characters from 33 to 255 in the Main Window message area and returns true. char ("A") A A onecharacter string is coerced to a character.[If value is a string of two or more characters or other value that cant be coerced to a number in the ASCII range of 0255, an error will be generated.b7c&Rù ݚĩݚLANDLANDb closeӴvxZrN close (address)es Read Meions) maddress is an address value that points to the object in the database whose editing window you wish to close.mUCloses the window in which the object at address is displayed and un-sets the target.U^True if the objects window was open or the object at address was the target, false otherwise.^edit (@examples.testOutline) true close (@examples.testOutline) true The second statement closes the window opened by the first. This verb operates similarly to window.close, except that the latter does not change the target. This verb essentially undoes the effect of edit. If a target other than address has been set, it remains in effect. target.clear window.close b#ŜgݚũݚLANDLANDb coerceValue+φ"zvC4G coerceValue (value, toType){e$y nvalue is the object whose datatype you wish to convert. toType is a string4 value indicating the desired type.nAsks the Apple Event Manager to convert value to the datatype indicated by toType. Frontiers built-in datatype coercion facilities are not used.[The resulting value of type toType if coercion is successful, an error condition otherwise.[coerceValue (6.23, stringType) same result as Frontiers string verb "6.23" coerceValue (6.23, 'doub') creates binary [doub] value "\x1EQ" coerceValue (12, listType) {12} coerceValue ({1, 2, 3}, stringType) error; no list-to-string AE coercion availablet toType can be one of Frontiers built-in types, such as stringType or doubleType, or any other 4-character code. This verb maps directly to the Macintosh AECoerceDesc function, and is not connected to Frontiers built-in data coercion facilities. If AppleScript is installed, any coercion 'osax' files in the Scripting Additions folder will be accessed by this verb.tbzȦLPl@ݚƩݚLANDLANDb complexEventKXFѶt" UcomplexEvent (tableAddr, appID, verbClass, verbID [, key1, value1 [, keyN, valueN]])UtableAddr is the address where the values returned by the destination application are to be stored. appID is a value identifying the application to which this verb is addressed. It can be a string4 containing the application signature, a binary value obtained by calling sys.browseNetwork or a string containing the application name or network address. The address of a binary code value may also be supplied (see Notes). verbClass is a string4 indicating the Apple event verb class. verbID is a string4 indicating the Apple event verb ID. key1 is a string4 indicating the keyword for the first parameter value. value1 is the first parameter value, and can be any type. [keyN, valueN] are additional keyword and parameter value pairs.%Sends an Apple event of the indicated class and ID to the application identified by appID, one parameter for each keyN, valueN pair provided, and waits for a reply. Each value in the reply is then added to the table at tableAddr, with each item named according to the values key in the reply.%}True if the message is successfully sent; otherwise false. Also fills in the table at tableAddr with the values in the reply.}complexEvent (@scratchpad.complexResult, 'BARC', 'app1', 'cwin') true A table has been created at scratchpad.complexResult, containing a single item named ---- that is a boolean value true. If BarCharts reply contained more than one item, the table would contain additional values.xIf the application indicated by appID is not running, or doesnt know how to handle the given verb, an error will occur.x Any number of key, value parameter pairs may be provided, including zero (none). Any key, value pair can be replaced by a table name. The values in the table will be included in the event, with the item names as the parameter keys. The item names must all be four characters long. In Frontier 3.0, a key, value pair can be replaced by a record value. The values in the record will be included in the event, with the record keys as the parameter keys. The type of each parameter value determines the corresponding descriptor type in the outgoing Apple event. The key of each item in the result determines the name of the corresponding table item, and the descriptor type determines the type of the value. In addition to sending Apple Events to other applications, this verb can be used to call a UCMD or OSA Script by passing the objects database address as the appID parameter.mappleEvent finderEvent sys.browseNetwork tableEvent setEventInteraction setEventTimeOut setEventTransactionIDmbZ͆ҋӶ:ݣݚǩݚLANDLANDb containswo̝lI:e expression1 contains expression2 Evaluates both expressions as strings, and determines whether the result of expression1 contains the result of expression2. If expression1 produces a list or record, expression2 is evaluated as a list or record and the comparison is done on that basis rather than as strings."The quick brown fox" contains "quick" true string.dateString () contains "Fri" true Thank God its Friday! 1234 contains 23 true The numbers are converted to strings for this operation. {1, 2, 3, 4} contains 3 true The number 3 is converted to a list, and the comparison results in true. {1, 2, 3, 4} contains {2, 4} false The first list contains the numbers 2 and 4, but not the list {2, 4} in sequence. {smoke: true, fire: false, heat: true} contains {file: false, smoke: true) true See Notes.+ The contains operator is case-sensitive; upper-case characters do not match lower-case ones. When applied to record values, the contains operator is not order-sensitive. It results in a true value as long as each item in the second record is contained in the first record and has the same value.+'beginsWith endsWith string.patternMatch'bخ&9pȩݚȩݚLANDLANDb continueOyFn0PD;* continueUUNܡ\y{XwLXN` YSkips the remaining statements in the body of the current for, loop, fileloop, or while statement. Script execution continues with the next iteration of the looping construct, after incrementing the counter (in a for statement), executing the loop iteration expression (in a loop statement), or assigning the next file (in a fileloop statement).Yfileloop (fName in folderPath) if file.isFolder (fName) skip folders continue if file.isLocked (fName) ... if file.size (fName) > 20000 ... (This is a script fragment; do not try to execute it in the Quick Script Window.) In this example, the use of the continue statement avoids having to indent the remainder of the loop body under an if statement. Typically, the continue statement will be used when there is more complex logic involved. for fileloop loop while breakT b=i6ݚɩݚLANDLANDb countAppleListItems#lԑ3W countAppleListItems (list)TF?V Alist is a binary value containing an Apple event descriptor list.A+Determines the number of items in the list.+4A number indicating the number of items in the list.4)countAppleListItems (sample.keyList) 5)RIf list is not a binary value containing a valid descriptor list, an error occurs.R Frontier 3.0 supports direct list and record manipulation. The sizeOf verb can be used to determine the number of list items. Valid list values can be created with putAppleListItem, or can be received from another application using complexEvent.@complexEvent tableEvent getAppleListItem putAppleListItem sizeOf@b6bRݚʩݚLANDLANDb dateR4p٨mz5akS1P1 date (value)ۤGOM'C Cvalue is the object whose datatype you wish to coerce to be a date.C7Coerces the datatype of value to be date if possible.7 A date valueTGͬNެ.tHw ~date (180) 1/1/4 ; 12:03 AM The time at 180 seconds (3 minutes) after midnight, January 1, 1904. date (2767729543) 9/14/91 ; 9:45 PM There are 2,767,729, 543 seconds between midnight, Jan. 1, 1904, and 9:45 p.m. on September 14, 1991. date ("4/20/91") 4/20/91 ; 12:00 AM See Notes for a discussion of valid string formats for the date verb. date ("Apr 26, 1991") 4/26/91 ; 12:00 AM See Notes for a discussion of valid string formats for the date verb. date ("April 20, 1991 8:15 PM") 4/20/91 ; 8:15 PM See Notes for a discussion of valid string formats for the date verb and the inclusion of a time in the string.~An attempt to coerce an inappropriate datatype (for example, a value that cant be coerced to a number) to a date will produce an error message. The appearance of the return value in the examples is the result of Frontiers coercing the date value to a string for display. The format in which date values are displayed, as well as the permissible format of strings being passed to this verb for coercion, is system dependent. You can supply a string as the value in any of the following formats: Numbers separated by slashes or dashes, in the order in use by the system (e.g., 4/20/91 or 20/4/91 or 42091 or 20491) Standard abbreviations for the month, with or without punctuation (e.g., April 20, 1991 or Apr 20, 1991 or Apr 20 1991). The full month, day and year (e.g., April 20, 1991). Any string containing a date in a valid format as explained in the previous note can optionally include a time in 24hour format or in 12hour format. If the 12hour format is used, the time must be followed by PM. The use of AM is, of course, optional, since 12hour and 24hour times are identical for AM settings. (If you insert periods after the P and/or the M in the string argument, Frontier ignores the attempt to create a PM time and treats the string as if an AM time were intended.) Clock verbsֺ+Z9,\ja bKD_ݚ˩ݚLANDLANDb DDEEventن <"H/.PBu IDDEEvent (appID, verbID, transactionID [, key1, value1 [, keyN, valueN]]I;appID is a value identifying the application to which this verb is addressed. It can be a string4 containing the application signature, a binary value obtained by calling sys.browseNetwork or a string containing a valid network address. verbID is a string4 indicating the Apple event verb ID. transactionID is a number identifying the transaction of which this verb is a part. key1 is a string4 indicating the keyword for the first parameter value. value1 is the first parameter value, and can by any type. [keyN, valueN] are additional keyword and parameter value pairs.;Sends an Apple event with the verb class 'DDE ' and with the specified verbID and transactionID to the application identified by appID, including one parameter for each keyN, valueN pair provided, and returns immediately, not waiting for a reply. TrueڵJֳr4989}{xc.*$n XFor examples of the use of DDEEvent, see the scripts in the system.verbs.apps.DDE table.XxIf the application indicated by appID is not running, or doesnt know how to handle the given verb, an error will occur.x This is a very advanced Frontier verb of primary interest to implementers and advanced scripters. It is not necessary to understand it to use Frontier effectively for most tasks. The transactionID parameter should be a value already agreed upon between the script and the destination application. Any number of key, value parameter pairs may be provided, including zero (none). The type of each parameter value determines the corresponding descriptor type in the outgoing Apple event. For all non-binary values, the descriptor type will be typeOf (value). For a binary value, the descriptor type will be getBinaryType (value). Thus, if you need to send a value with a different descriptor type than Frontiers default, you can coerce the value to a binary value, and then use setBinaryType to specify the desired type. Since most standard DDE events have an associated "ack" message, you will typically need to define a handler for the return event in the system.verbs.traps.DDE table, and process the response asynchronously. ;appleEvent setBinaryType sys.browseNetwork transactionEvent;b!M{DݚͩݚLANDLANDb definedef Toa> defined (value)òsTGm ?value is a database object whose existence you wish to confirm.?%Determines whether the object exists.%*True if the object exists, false otherwise*defined (examples.testText) true Its there local (s = "testText"); defined (examples.[s]) true An item named testText is in the examples table. defined (examples[99]) false There arent 99 items in the examples table.lThis verb is useful to validate an address or to see if an object exists before attempting to operate on it.lb%pcݚΩݚLANDLANDb deleteG͢cT;z~2p delete (address)U!w= ^address is an address value that points to the object in the database that you wish to remove.^%Deletes the object stored at address.% TrueY h4,M◯n delete (@examples.flag) true An object actually existed at this location in the database. delete ("examples.flag") true Formatted as a string, Frontier coerces the string to a database address. Supplying an address which Frontier cannot coerce into a valid address form produces an error. Attempting to delete an object that has not been defined results in an error.b tɩݚϩݚLANDLANDb directionHsf:¿"yzHO9jC} direction (value)aZ~n߱Bi Hvalue is the object whose datatype you wish to coerce to be a direction.H>Coerces the datatype of value to be directionType if possible.>SA valid Frontier direction if coercion is successful; an error condition otherwise.Sydirection (1) up Frontier defines seven valid directions, numbered 06. See the discussion of datatypes in Chapter 1 of the UserTalk Reference Guide for details. direction (5) flatup direction (0) nodirection The example above uses a special Frontier direction value that can be used to remove a previous setting for a direction, for example. direction ("up") upySupplying any value other than the integers 06, or the string representation of a valid Frontier direction, results in an error message.MThe direction verb may prove useful in interacting with users who are being guided through navigating an outline. If the user supplies a string to indicate a direction he wants to travel, for example, coercing the string with direction would enable you to use any of the outline navigating verbs with the users input as a parameter.M$Outline processing navigation verbs.$b)}&@ ݚЩݚLANDLANDb displayString0skw}vQ displayString (value)v Gvalue is the object whose data you wish to convert to a display string.GConverts value to a display string representation, including quotes and other special characters, matching a literal instance of the value as closely as possible. The resulting string.-;<`[4& displayString (12) 12 displayString (point.set (12, 24)) {12, 24} displayString (clock.now ()) "10/28/91; 12:14PM" displayString (tab) "\t" If you attempt to reproduce the above examples in Frontier, youll notice an extra set of quotes. Thats because the Quick Script window and the Run Selection command already apply the displayString verb to the result. To see the actual result of displayString, simply enter the value itself into the Quick Script window. The display string of a value is syntactically valid; it can be evaluated in an expression. However, the result may not be the same data type as the original value. The displayString verb will utilize any available coercion handlers installed in the system to create a textual representation of a binary value. stringaQS^O!v4 b7c_ ݚѩݚLANDLANDb doubleDF}*3$(Cڂjg b>j7%ݚթݚLANDLANDb fileloop0Wl!]'ݚکݚLANDLANDb forQS^O!v40U2]Q wfor identifier = expression1 to expression2 statements or, for identifier = expression1 downto expression2 statementsw Evaluates expression1 and expression2 as numeric values, and assigns the result of expression1 to identifier. As long as the value of identifier is less than or equal to the result of expression2, for does the following: 1. executes statements; 2. adds 1 to the value of identifier. In the second form, using the downto keyword, statements are executed as long as the value of identifier is greater than or equal to the result of expression2, and 1 is subtracted from the value of identifier each time through the loop. Bfor i = 1 to sizeOf (root) { msg (nameOf (root [i])); clock.waitSixtieths (30)} It posts the name of each item in the root table to the Main Window, pausing a half-second between each one. for i = 3 to 2 {msg ("This statement will not be executed")} for i = 3 downto 2 {msg ("This statement will be executed twice")}B If the result of expression1 is greater than that of expression2, the loop body will not be executed even once. The action of the for statement is almost identical to the following loop statement: loop (identifier = expression1; identifier <= expression2; ++identifier) statements However in the for statement, the expressions are always evaluated as numbers, and expression2 is evaluated once before entering the loop, rather than for each iteration. This gives the for statement a substantial performance advantage. "for in loop while break continue"b56689<@ݚ۩ݚLANDLANDb for inb *UQH I#R (for identifier in expression statements(Evaluates expression as a list. For each item in the list, for does the following: 1. assigns the value of the current item in the list to identifier; 2. executes statements;for i in {1, 3, 5, 7} { msg (i); clock.waitSixtieths (30)} It posts the numbers 1, 3, 5 and 7 to the Main Window in sequence, pausing a half-second between each one. folders = {"Extensions", "Control Panels", "Startup Items"} for f in folders { searchFolder (file.getSpecialFolderPath ("", f, false))} This calls the script searchFolder for each of three special system folders.5 Values are assigned to identifier in the same order that they appear in the specified list. The action of the for in statement can be emulated using a standard for loop and the list and sizeOf verbs, as follows: temp = list (expression) for i = 1 to sizeOf (temp) identifier = temp [i] statements5 for sizeOf list break continue b<<= =?R@EݚܩݚLANDLANDb gestalta1 L/ gestalt (selector)Ty>nΧzn eselector is a string4 corresponding to one of the selectors defined by the Macintosh Gestalt Manager.eACalls the Macintosh Gestalt function with the indicated selector.A[The numeric response obtained from the Gestalt Manager, or -1 if the selector is undefined.[gestalt ('mach') check the machine type 18 The result indicates that were running on a Mac IIsi gestalt ('proc') check the processor type 4 The result indicates that the CPU is a 68030 This is an advanced verb that retrieves low-level information about the hardware and software operating environment. Its intention is to provide an escape valve for retrieving such information where its not available through higher-level verbs. The valid values for selector are documented in the Compatibility Guidelines chapter of Inside Macintosh, Volume VI (Addison Wesley).bA-AYAABCBCxKݚީݚLANDLANDb getAppleListItem^] N= +getAppleListItem (list, position, itemAddr)+list is a binary value containing an Apple event descriptor list position is a numeric index or a string4 key indicating which list item is desired itemAddr is the address where the indicated value is to be storedeExtracts from list the value indicated by position, and puts it in the database location at itemAddr.e^True if the indicated item was found and copied into itemAddr, false if no such item was found^getAppleListItem (sample.keyList, 'word', @x); x hellothis string value with the key 'word' was in the list getAppleListItem (sample.descList, 2, @x); x worldthe second item in the list was this string valueRIf list is not a binary value containing a valid descriptor list, an error occurs.R Frontier 3.0 supports direct list and record manipulation using square bracket syntax. Items in keyed list (AERecords) can be extracted by key or index; items in indexed lists can only be extracted by index. Requesting an item that isnt found (because the key doesnt exist, or the index is out of range) causes the verb to return false, but is not an error. Valid list values can be created with putAppleListItem, or can be received from another application using complexEvent.@complexEvent tableEvent countAppleListItems putAppleListItem [ ]@bEtEEFG)GHvHJOݚߩݚLANDLANDb getBinaryTypex KmXD! Su getBinaryType (value)S}D˒ "value is a binary Frontier object."1Determines the specific binary datatype of value.1 The binary datatype of value.\# 5x = binary ("Cool stuff!"); getBinaryType (x) TEXT5 All binary objects in Frontier contain both data and a type. The type of all binary objects, which you can obtain with the typeOf verb, is 'data'. This verb determines which specific type of data a binary object contains. When you coerce a non-binary value to binary, the resulting value has an embedded type that corresponds to the value that would be returned by the typeOf verb applied to the original value. This verbs primary use involves values received from outside Frontier via pasting or an IAC dialog. When Frontier receives data it does not understand, it creates a binary value with a binary type determined by the clipboard or descriptor type of the data. setBinaryType typeOfoW; bKKKLLDLpLOcUݚݚLANDLANDb getEventAttributeh -ba`{ type is a valid Frontier datatype as described in Chapter 1 of the UserTalk Reference Guide. addr is the location in the Frontier Object Database table where you want the new object created.LCreates a new object of the indicated type at Object Database table address.L4True if the creation is successful; false otherwise.4snew (outlineType, @examples.newOutline) true new (booleanType, @examples.["Software is my way of life"]) trues Supplying an invalid type results in an error message. Supplying an addr argument that cant be coerced to an address results in an error message. Running out of memory in the process of creating a new object can also result in an error.bRݚݚLANDLANDb not*U侊q_ܽWj꽚\ not expression !expression˞;Z The logical negation (boolean not) operator, yields the boolean value true if expression evaluates to false, or false if expression evaluates to true.^not file.exists ("myFile") true This expression evaluates to true if the file does not exist; if the file does exist, it evaluates to false. if not dialog.confirm ("Discard everything?") return (false) Here we check to see whether or not dialog.confirm returned true. If not, the user pressed Cancel and the return (false) statement is executed.^8There is no difference between the two forms, ! and not.8 and or ifcqj{j:bݚݚLANDLANDb nthElement)})Ss`9x nthElement (class, n, container) class is a string4 identifying the Apple Object Model class. n is a number specifying the 1-based index position of the element being sought. container is the specifier of the object in which this verb specifies an element.>Obtains a specifier for the nth element of class in container.>)The object specifier of the indexed item.)InthElement (cWord, 4, x) (specifies the fourth word in container "x")ITo indicate the nil container, use the number zero. This verb is implemented as a small script that calls setObj, to which it is closely related. setObj namedElement#ooee bD6өݚݚLANDLANDb nthWindow̢c+= `|, nthWindow(n)_2{3s/lۙQۉ On is a number specifying the 1-based index position of the window being sought.O,Obtains a specifier for the nth open window.,#The object specifier of the window.#CnthWindow (9) (specifies the 9th window open in the application)CbThis verb is implemented as a small script that calls nthElement, of which this is a special case.b nthElement setObj;O/5v(ۉ b(9(ݚݚLANDLANDb numberL?9[`V@2u%Ã?~ number (value)~R`P Lvalue is the object whose datatype you wish to coerce to be a numeric value.LNCoerces the datatype of value to be a 32bit signed numeric value if possible.N]The numeric value produced by the coercion if it is successful, otherwise an error condition.]number (123456) 123456 number (1575.23) 1575 number (infinity) 2147483647 The example above shows the largest value that can be represented by a 32bit signed number. number (".009") 0Passing a string that isnt a valid number or passing a value that cant be coerced to a long (e.g., a rect) results in an error message. See the discussion of datatypes in Chapter 1 of the UserTalk Reference Guide for information on the range of values that can be represented by a number, and for other details. This verb is a synonym for long. Long}Fݘ_C70ٍ vc_6K7 bAmK@ݚݚLANDLANDb objspecdCyjo objspec (value)̳>}a}CЇ 8value is a value which you wish to convert to an objspec8If value is a binary value, or the number zero, converts it to an objspec value. If value is already an objspec value, no conversion is done. The resulting objspec valuey objspec (binaryVal) true\ hIf value is any type other than objspec or binary, and is not the number zero, an error message results.hq This is an advanced Frontier verb of primary interest to implementers and advanced scripters. It is not necessary to understand it to use Frontier effectively for most tasks. To create a new objspec value, use setObj. Future versions of Frontier may support coercion from types other than binary, in particular from a string representation of an object specifier.q setObj5]͌Zf]\\C=k b2#QݚݚLANDLANDb onfAwx6g0gS`gA =on identifier (idParam1, idParam2, ..., idParamN) statements=Defines a local script named identifier, with parameters idParam1 through idParamN. The body statements are not executed; that occurs only when the script is invoked with a function call, consisting of identifier followed by a list of parameters enclosed in parentheses. on lockFiles (folder) local (fName) fileloop (fName in folder, infinity) file.lock (fName) lockFiles ("HD80:folder1:") lockFiles ("HD80:folder2:") Type this script into a script window. This example demonstrates the use of a local script to allow a particular bit of functionality in this case locking all of the files in a folder to be reused within a script. The on statement defines the lockFiles local script, which takes a single parameter that is expected to be the path of a folder. Below the script definition are two calls to the script, passing two different folders to be operated on. on countWindows () return (appleEvent (app.id, 'app1', 'twin')) This is the script for app.countWindows in Frontier.root. In this case, the local script countWindows takes no parameters, and its body is the single return statement that returns the result of an appleEvent call. Since the entire script consists of a local script definition, running the script will do nothing but define the script; there is no call to countWindows to cause its body statements to be executed. Scripts like these are intended to be called externally, by other scripts. A script that wishes to execute countWindows must name its database cell in a function call, as in numWindows = app.countWindows ().  The number of parameters defined in the on statement is strict; all calls to the script must provide exactly that number. If the script does not take any parameters, an empty parameter list () must be provided in both its definition and any calls to it. The scope of a script defined with the on statement is generally the same as that of local variables, lasting the rest of the statement block that contains it. However, if the script is the first local script in a script object, and its name matches that of the database cell that contains it, then scripts elsewhere in the database can call it by naming the database cell (and providing the appropriate parameter list). The on statements parameter list defines the local scripts name and the name of each parameter it requires. There is no specification made of what type of values are expected for each parameter, and thus there is no type validity checking when the script is called. If a parameter is provided whose type is inappropriate for a statement in the script body, an error will occur when executing that statement. If a script is intended to be callable from other scripts, it is important that its name match that of the database cell containing it. If the name does not match, the script will be assumed to be local to the implementation of the database script. The on statement will be executed as a definition, with the expectation that a call to it will appear subsequently in the body of the database script. Local scripts are database objects, just like other scripts that you work with in tables. As such, you can take their address with the address operator, and use that address in any context where the address of a script is called for. @ ( ) bundle local return҇e b#=U%ݚݚLANDLANDb or]!9üϡ9rxN'Ӊ 5expression1 or expression2 expression1 || expression25The logical disjunction (boolean or) operator, yields the boolean value true if either expression1 or expression2 evaluates to true, false otherwise.Gfile.exists ("myFile") or !file.exists ("myFile") true This expression always evaluates to true, because it is impossible for both expressions to be false at the same time. file.isFolder ("myFile") or (file.type ("myFile") != 'TEXT') true This expression evaluates to true if myFile is a folder, or is not a text file.G There is no difference between the two forms, || and or. UserTalk employs short-circuit evaluation of boolean expressions. That means that if expression1 of an or operation evaluates to true, expression2 will not be evaluated, since it can already be determined that the result of the operation will be true. So in example #2 above, the call to file.type will never be made if file.isFolder returns true. and notb{AC ֻ>` b,"ݚݚLANDLANDb pack%z<,Oә әaә ts} pack (value, binaryAddr)^/> value is the object you wish to pack into a binary datatype. binaryAddr is the address where the binary version of value is to be stored.bPacks value into a contiguous byte stream and puts the result into the binary value at binaryAddr.b True]}I w}8;~gF pack (scratchpad, @x) true x now contains a packed binary version of the scratchpad table pack ('a', @x); return (x) 0x61 ASCII value for the character "a"# The binaryType of the binary value is set to typeOf (value). For scalar values, the packed binary form is identical to the value created by simple coercion using the binary verb. However, this verb can operate on any datatype, while binary coercion can only be applied to scalar values.# unpack binary getBinaryTypeOo^ bbOשݚݚLANDLANDb point93M&X9tۼbn point (value)x^&jV̔m Cvalue is the object whose datatype you wish to coerce to pointType.C8Coerces the datatype of value to be a point if possible.8 The resulting point value66z Lpoint ("0, 23") 0, 23 Horizontal position of 0, vertical position of 23LvIf value is an improperly formatted string or a type that cannot be coerced to a point, an error message is generated.vwThis is an advanced Frontier verb of primary interest to implementers and advanced scripters. It is not necessary to understand it to use Frontier effectively for most tasks. This verb is most useful in dealing with Macintosh-specific IAC situations where a point value is required by one of the programs involved in the IAC process. In order for a string value to be recognized as a point, it must be made up of two short numbers separated by a comma. The first value is the horizontal, or X, coordinate value, and the second is the vertical, or Y, coordinate value. Leading blanks are allowed before each number in the string.wbc NzTݚݚLANDLANDb propertyґс 6_i:ߑsay property (property, container) property is a string4 Apple Object Model property constant container is specifier for the object that contains the property being specified.HCreates an Apple event object specifier for a the property of container.H The resulting object specifier dproperty ('cfon', wordSpec) true Specifies the font property of the object specified by wordSpec.dThis verb is implemented as a small script that calls setObj, to which it is closely related. Values for all of the standard properties are defined in system.macintosh.constants. setObjH33ӆ3`O\L' bEq5%ݚݚLANDLANDb putAppleListItem 俔]RK +putAppleListItem (item, position, listAddr)+'item is the value to be added to the list, and can by any type. position is a numeric index or a string4 key indicating where the list item should be placed in the list. listAddr is the address of a binary value containing an Apple event descriptor list, or where such a value should be created.'9Adds item to the descriptor list at itemAddr with the index or key indicated by position. If no object exists at itemAddr, a new list is created according to the type of position: if a key is provided, a keyed list is created (an AERecord); if an index is provided, an indexed list is created (a descriptor list).9 True /<\|v'=~ putAppleListItem ("hello", 'word', @sample.keyList) true the string value with the key 'word' was added to the list putAppleListItem ("world", 2, @sample.descList) true the second item in the list was set to be the string value If there is an object at listAddr that is not a binary value containing a valid descriptor list, an error occurs. If position is a string4 keyword, and the list is not a keyed list, or if an index is provided that is out of range, an error occurs.@ Frontier 3.0 supports direct list and record manipulation using square bracket syntax and addition. Passing a zero index in position indicates that the item is to be added at the end of the list. If an item with the given index or key already exists in the descriptor list, the new value replaces the existing one.@(countAppleListItems getAppleListItem [ ](b}éXƄ{Ȃ͏ݚݚLANDLANDb randomg1pp9W:{ Ùo 1}p random (lower, upper)3 lower is a number that defines the smallest random number you wish to generate. upper is a number that defines the largest random number you wish to generate.Generates a random number between lower and upper. The range is inclusive on both ends (that is, it is possible that both lower and upper will be generated by the use of this verb). The random number generated.9 bz random (1, 5) 4 The return could be 1, 2, 3, 4, or 5. random (5, 5) 2 The return could be 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, or 5.If either lower or upper is not an integer value, an error message is generated. If upper is less than lower, this verb generates an error.bpʜr3_HݚݚLANDLANDb recordGjڨ~3^>,S record (value)6kzJ=M5Y Evalue is the object whose datatype you wish to convert to recordType.EkConverts value to a record representation. Only a few specialized data formats can be converted to records.kMThe resulting record if coercion is successful, an error condition otherwise.MWrecord ({}) an empty list can be coerced to an empty record {} with objectModel {record (word [1].character [3])} {'want':character, 'from':word [1], 'form':indexKey, 'seld':3} In this example, an object specifier is converted to a record record ("error") This example produces the error "Cant coerce a string value to a record."W7Most scalar values cannot be coerced to a record value.7 list coerceValue)))8>t b)UΦv_ݛݛLANDLANDb rectY?tjͫ^ st|eɕ" rect (value)L:eo͡N>9E Bvalue is the object whose datatype you wish to coerce to rectType.B7Coerces the datatype of value to be a rect if possible.7 The resulting rect valueqC> Wrect ("0, 0, 512, 342") 0, 0, 512, 342 top = 0, left = 0, bottom = 512, right =312WIf value is an improperly formatted string or a type that cannot be coerced to a rect, an error message is generated. Only strings and binary values that are 8 bytes long can be converted.\This is an advanced Frontier verb of primary interest to implementers and advanced scripters. It is not necessary to understand it to use Frontier effectively for most tasks. This verb is most useful in dealing with Macintosh-specific IAC situations where a rect value is required by one of the programs involved in the IAC process. In order for a string value to be recognized as a rect, it must be made up of four short numbers separated by commas. The numbers are interpreted as the top, left, bottom and right coordinates, respectively. Leading blanks are allowed before each number in the string.\bѶ\ҟ.ڞݛݛLANDLANDb returnwml뭚'U~ÿ_' return (expression)樭s }Evaluates expression and exits the current script, with the result of expression being the value of the call that invoked it.}on exponentiate (n, power) local (i, exp = 1) for i = 1 to power exp = exp * n return (exp) result = exponentiate (10, 3) Type this script into a script window. In the last line of exponentiate, the local variable exp is the expression whose value is returned by the script. In the assignment statement below it, the call exponentiate (10, 3) evaluates to 1000 the value of exp when it is used in the return statement. Thus, the value 1000 is assigned to result.The parentheses around the expression being returned are not required, but we recommend their use for improved readability. This is a matter of scripting style and has no effect on the statements execution. onbm+ƺXןk1>{Ě b%׮ٗrߴݛݛLANDLANDb rgbw.z0x[?3lUzm rgb (value)~chpiY Avalue is the object whose datatype you wish to coerce to rgbType.A@Coerces the datatype of value to be an rgb datatype if possible.@ The resulting rgb value.7 Trgb ("30, 40, 50") 30, 40, 50 red value = 30, green value = 40, blue value = 50TIf value is an improperly formatted string or a type that cannot be coerced to an rgb, an error message is generated. Only strings and binary values that are six bytes long can be converted.TThis is an advanced Frontier verb of primary interest to implementers and advanced scripters. It is not necessary to understand it to use Frontier effectively for most tasks. This verb is most useful in dealing with Macintosh-specific IAC situations where an rgb value is required by one of the programs involved in the IAC process. In order for a string value to be recognized as an rgb, it must be made up of three short numbers separated by commas. The numbers are interpreted as the red, green and blue components, respectively. Leading blanks are allowed before each number in the string.Tb 8d۱)܉TQݛݛLANDLANDb rollBeachBall<% Xf&< rollBeachBall ()ӝ{ 궛e None required.ѹa#f5^.&L` KChanges the Frontier beachball cursor to the next position in its rotation.K Truefe6czqz3gf{6ӳ rollBeachBall () true x = 0; for x = 1 to 1000 {msg (x); rollBeachBall ()} true Script displays numbers from 1 to 1000 and rolls the beachball cursor as it does so.fIts a good idea to roll the beachball during a time-consuming process to give the user some feedback.fb"Nz)tݛݛLANDLANDb runSelection*/P"2n%ğo runSelection ()~=|V[G9n None required.M㙽ko>o﫜 Depends on the type of window that is frontmost: In a menubar window, runs the script attached to the bar cursor In a table window, runs the selected script or string In an outline window, runs the selected headline In a text window, runs the selected text as a string5Result of the execution of the selection as a script.5&Open root.examples.docs and select the entry labeled Basic1. It is a string containing: dialog.confirm ("OK to trash hard disk?"). In the QuickScript Window, execute: runSelection () true Returns true regardless of your answer to the dialog, indicating that the command executed correctly.&yA variety of errors can be generated if the selection is not a valid Frontier script, depending on what is wrong with it.y The Frontier Command-/ command is implemented using runSelection. If you execute runSelection in an outline structure, Frontier deposits the result of the execution as a comment immediately beneath the selected structure. evaluateRNO(IƊ bCc[H©ݛݛLANDLANDb scriptError ~ZeBK scriptError (string)Noj( gstring is a string containing the error message you wish to display when this statement is encountered.gaTerminates processing of the script and displays string in the Frontier error information window.a;False because it terminates the script in which it is used.;KscriptError ("Can't run this -- it tried to trash your hard disk.") trueK scriptError uses the same error-reporting mechanism as Frontiers interpreter. This verb permits you to define verbs so that they report errors the same way as Frontiers built-in verbs do. This makes use of your custom verbs transparent to the user.b:a ݛݛLANDLANDb setBinaryType+ke50 setBinaryType (addr, type)pV] addr is the address of the object whose binary type you wish to change. type is a string4 specifying the binary datatype to be set.:Changes the binary datatype of the object at addr to type.: TrueehuӬ~KaW MW&t 9scratchpad.x = 23; setBinaryType (scratchpad.x, charType)9addr must contain a binary value, not a scalar or complex datatype. This verb is most useful for setting the binary type of a binary value to make sure parameters are correct for an Apple event exchange when an application requires data of a type Frontier does not directly support. getBinaryType ,wmi g b0\]ݛ ݛ LANDLANDb setEventInteractionn6o7 GZu setEventInteraction (allow)I=k lallow is boolean value indicating whether or not outgoing appleEvent messages should allow user interaction.lYEstablishes the interaction setting for all outgoing messages sent by the current script.Y True.ޫ}ֆO:.`; string4 (value)Co6^ value is usually a four-character string. It can, however, be any value that can be represented in four bytes and whose datatype you wish to coerce to string4Type.1Converts value to have a datatype of string4Type.18The four-character string resulting from the conversion.8Hstring4 ("LAND") LAND scratchpad.idprogram = string4 ("abcd") abcdHiThe string4 datatype uses less storage than the string datatype applied to a string of the same length.i stringBrcԃGQ bEqL!ݛݛLANDLANDb sysCrash(+ B9=~s SysCrash ()!Bz[Hтe None requiredX<cq,+3u @Crashes Frontier into the low-level system debugger, if present.@FTrue, once the debugger is exited and control is returned to Frontier.F`syscrash (); msg ("back from the dead!") back from the dead is displayed in the Main Window` This is an advanced Frontier verb of primary interest to implementers and advanced scripters. It is not necessary to understand it to use Frontier effectively for most tasks. This verb is intended primarily for debugging purposes. If no debugger is present in the system, a bomb box results, requiring a system restart. If youre not sure that a debugger is running, don't use this verb! scriptErrort ):w MWJI b0\RS"GݛݛLANDLANDb systemEventi$껒.'ϕr BsystemEvent (verbClass, verbID [, key1, value1 [, keyN, valueN]])B8verbClass is a string4 indicating the Apple event verb class. verbID is a string4 indicating the Apple event verb ID. key1 is a string4 indicating the keyword for the first parameter value. value1 is the first parameter value, and can be any type. [keyN, valueN] are additional keyword and parameter value pairs.8Sends an Apple event of the indicated class and ID to a System EventX, one parameter for each keyN, valueN pair provided, and interprets the reply.MThe value contained in the reply from the handler. The value can be any type.M|systemEvent ('barc', 'gval', '----', short (n)) 4 BarChart installs a system event handler for the "get bar value" event|QIf no system event handler is installed to handle the event, an error will occur.Q Any number of key, value parameter pairs may be provided, including zero (none). Any key, value pair can be replaced by a table name. The values in the table will be included in the event, with the item names as the parameter keys. The item names must all be four characters long. In Frontier 3.0, a key, value pair can be replaced by a record value. The values in the record will be included in the event, with the record keys as the parameter keys. The type of each parameter value determines the corresponding descriptor type in the outgoing Apple event. For all non-binary values, the descriptor type will be typeOf (value). For a binary value, the descriptor type will be getBinaryType (value). Thus, if you need to send a value with a different descriptor type than Frontiers default, you can coerce the value to a binary value, and then use setBinaryType to specify the desired type. The descriptor type in the result determines the type of the result value. If it corresponds to one of Frontiers built-in types, a value of that type is returned. Otherwise, a binary value is returned, with its binaryType set to the descriptor type. appleEvent setBinaryTypezo'vԌ bgQ2"+ ݛݛLANDLANDb tableEventbAP`5!=`- `tableEvent (paramsAddr, resultAddr, appID, verbClass, verbID [, key1, value1 [, keyN, valueN]])`9paramsAddr is the address of a table containing the values to be sent as parameters to the event. resultAddr is the address where the values returned by the destination application are to be stored. appID is a value identifying the application to which this verb is addressed. It can be a string4 containing the application signature, a binary value obtained by calling sys.browseNetwork or a string containing the application name or network address. verbClass is a string4 indicating the Apple event verb class. verbID is a string4 indicating the Apple event verb ID.9*Sends a Apple event of the indicated class and ID to the application identified by appID, one parameter for each item in the table at paramsAddr, and waits for a reply. Each value in the reply is then added to the table at resultAddr, with each item named according to the values key in the reply.*}True if the message is successfully sent; otherwise false. Also fills in the table at tableAddr with the values in the reply.}tableEvent (@scratchpad.labelInfo, @scratchpad.result, 'BARC', 'BARC', 'slab') true The table scratchpad.labelInfo had been set up to contain the number and label of a column, which became the parameters to the "setBarLabel" verb sent to BarChart. The verb then created a table at scratchpad.result, containing a single item named ---- that is a boolean value true. If BarCharts reply contained more than one item, the table would contain additional values.xIf the application indicated by appID is not running, or doesnt know how to handle the given verb, an error will occur.xThere is no difference between calling tableEvent and calling complexEvent with the table at paramsAddr included in the parameter list. Using this verb highlights the fact that a table is being used as the source for the parameters.oappleEvent complexEvent finderEvent sys.browseNetwork setEventInteraction setEventTimeOut setEventTransactionIDob""#M%&'Q)-)*/کݛݛLANDLANDb timeCreatedo&砥/= timeCreated (address)v핪Bz z -address is an Object Database table location.-<Retrieves the time the object stored at address was created.<pThe date and time the object was created unless no such object exists, in which case an error condition results.ptimeCreated (@root) 7/10/91 ; 3:16 PM timeCreated (@examples.funStuff) 9/7/91 ; 5:16 PM timeCreated (@nothing) false Error also generated because nothing has not been defined. timeCreated (@examples.age) false creation time not maintained for this typeIf no object exists at address, Frontier returns an error indicating the name address has not been defined. Supplying the address of an object that is not one of the supported types (see Notes, below) returns false, but it is not an error.This verb applies only to Frontier objects that can be displayed and edited in their own window. These types are: outline, script, menubar, table, wptext, and picture. timeModifiedO35~&V0o b+++,,g,-./4ܩݛݛLANDLANDb timeModified_3|FG timeModified (address)d b=c==>@BHݛ ݛ LANDLANDb typeOfy=b$j^OUOmVO.Ȣ typeOf (value):F-z5 Dvalue is an object of any datatype whose type you wish to determine.D!Determines the datatype of value.!typeOf (2+2) long typeOf (examples.testText) wptx datatype for word processing text objects typeOf (@examples.testText) addr The parameter provided is an address; therefore, it is not the type of the object at that location that is returned. typeOf (examples[1]) long First entry in table as sorted is "age," a long. if typeOf (examples.list1) != outlinetype {msg ("Who messed with this object?")} You can use typeOf to determine the datatype of a user entry or of a return value from another script so you can determine if it can and should be coerced, for example. Although typeOf returns a four-character type identifier, you never need to use this information in your scripts. Frontier defines a constant for each of these types. They are stored in the Object Database at system.compiler.language.constants and are also listed in Chapter 1 of the UserTalk Reference Guide. This also means that if you use typeOf in a script where you wish to check the type of an object, you should use the constant value, as in the fifth example, above. sizeOfpE6_tc$'{eF bC]CCDD2EHuLݛ!ݛ!LANDLANDb unpackd,L6Y&]}5t|Wʼ unpack (binaryAddr, valueAddr) binaryAddr is the address where the binary version of a value is stored. valueAddr is the address where the unpacked version of the value is to be stored.Unpacks the binary data at binaryAddr into its original datatype, as indicated by the binaryType, and puts the result into valueAddr. Truee{V ohX/ Yunpack (@x, @root.temp) true root.temp now contains the value that was packed into xYIf the binaryType of the value at binaryAddr is not one of Frontiers standard datatypes, or if the packed binary data does not correspond to that datatype, an error will occur.]Normally, the value at binaryAddr should have been created by either the pack or binary verb.] pack binary nNw+o,ѳO bII;IgJ JJK/KLUPݛ#ݛ#LANDLANDb whileU@%f羪| BW˔D while expression statementsm 7 xEvaluates expression. As long as it evaluates to true, the loop statements are executed, and expression is re-evaluated.xwhile scratchpad.x < 0 if not dialog.getInt ("Enter a positive number:", @scratchpad.x) return (false) This loop repeats until the user enters a positive value for scratchpad.x or cancels the dialog. Note that the dialog will never be presented if scratchpad.x is already greater than zero. while window.frontmost () != "" window.hide (window.frontmost ()) This loop hides all of the open windows, including the Main Window.YIf expression initially evaluates to false, the loop body will not be executed even once.Y for loop break continue9?by= bLMMGMOOWݛ$ݛ$LANDLANDb withޅw̍j%pyw^~6 /with expression1 [..., expressionN] statements/Adds the table referred to by expression1 to the local context so that items in that table can be named directly, without including the table name. Repeats the precess for the remaining expressions, if provided, to add more tables to the local context.app.start ("BarChart") start up the BarChart application with BarChart newWindow (4, "Temperatures in Woodside", " F") setBar (1, "Jan", 54) set the label of bar 1 to Jan, value to 54 setBar (2, "Apr", 67) setBar (3, "Jul", 82) setBar (4, "Oct", 73) In this example, a sequence of BarChart verbs are called, but the with statement allows the BarChart. portion of the verbs paths to be omitted. with objectModel, Excel set (cell ["R1C1"].font, "Times") Here, the with statement provides the required context to define the verb "set", as well as the terms "cell" and "font". This construction is typical of scripts that drive applications that use the object model protocol.< Each item in the with statement can be a simple name, a dotted name, a dereferenced address, or any other expression that specifies an existing table. The expressions can rely on the context of the previous item having been set up. With statements can specify up to seven tables, and can be nested. If the same name is defined in more than one table, the table that appears later in a with statement will take precedence. With statements can also be used to specify an object in an object-model application. See the Scripting the Object Model document for details.< @ ^Jgpee=,ލnp bPPPQTVa7ݛ%ݛ%LANDLANDb { }hn,8 hԭ ģY @{ statements } or, { expr, expr } or, { key: expr, key: expr }@*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 Frontiers 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.*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.Since the Quick Script window has no outline structure, if you enter a script that isnt 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. ; [ ] list record/{ bWWX[;_]a ݛ'ݛ'LANDLANDb objectModel.afterȆ w_ objectModel.after (obj)'~bO Kobj is the specifier of the object after which an object is to be inserted.KpCreates a typeInsertionLoc descriptor record specifying insertion immediately following obj, in obj's container.p0A binary value containing the descriptor record.0Dwith objectModel {create (window, 0, 0, after (window [1]))} trueD This verb can only be used with applications whose verbs are based on the object model protocol. This verb is implemented as a small script that calls insertionLoc.fobjectModel.before objectModel.beginningOf objectModel.endOf objectModel.replace core.create core.movefbaaabTbc c\dgΩݛ(ݛ(LANDLANDb objectModel.before*h7t objectModel.before (obj) Lobj is the specifier of the object before which an object is to be inserted.LpCreates a typeInsertionLoc descriptor record specifying insertion immediately preceding obj, in obj's container.p0A binary value containing the descriptor record.0Ewith objectModel {create (window, 0, 0, before (window [1]))} trueE This verb can only be used with applications whose verbs are based on the object model protocol. This verb is implemented as a small script that calls insertionLoc.eobjectModel.after objectModel.beginningOf objectModel.endOf objectModel.replace core.create core.moveebdeeHeffXfg]k;ݛ)ݛ)LANDLANDb objectModel.beginningOfb objectModel.beginningOf (obj) ]obj is the specifier of the object within which an object is to be inserted at the beginning.]xCreates a typeInsertionLoc descriptor record specifying insertion as the first element of the object's class within obj.x0A binary value containing the descriptor record.0Rwith objectModel {create (word, "sample", 0, beginningOf (paragraph [1]))} trueR This verb can only be used with applications whose verbs are based on the object model protocol. This verb is implemented as a small script that calls insertionLoc.`objectModel.before objectModel.after objectModel.endOf objectModel.replace core.create core.move`bh<hhhhiijjnݛ*ݛ*LANDLANDb objectModel.endOf _gB objectModel.endOf (obj)S8$k$n Wobj is the specifier of the object within which an object is to be inserted at the end.WwCreates a typeInsertionLoc descriptor record specifying insertion as the last element of the object's class within obj.w0A binary value containing the descriptor record.0Lwith objectModel {create (word, "sample", 0, endOf (paragraph [1]))} trueL This verb can only be used with applications whose verbs are based on the obel protocol. This verb is implemented as a small script that calls insertionLoc.fobjectModel.before objectModel.after objectModel.beginningOf objectModel.replace core.create core.movefbkklldlm#m{n/qݛ+ݛ+LANDLANDb objectModel.replace_u~ objectModel.replace (obj)sR Nobj is the specifier of the object to be replaced by an object to be inserted.NPCreates a typeInsertionLoc descriptor record specifying insertion replacing obj.P0A binary value containing the descriptor record.0bwith objectModel {move (document [1].paragraph [1], replace (document [1].paragraph [1]))} trueb This verb can only be used with applications whose verbs are based on the object model protocol. This verb is implemented as a small script that calls insertionLoc.dobjectModel.before objectModel.after objectModel.beginningOf objectModel.endOf core.create core.movedboo;ogoppYpq{ݛ+ݛ+LANDLANDb point.get ҕy 4ȿ point.get (point, haddr, vaddr) point is a Macintosh pointType. haddr is the address where the horizontal portion of the point is to be stored. vaddr is the address where the vertical position of the point is to be stored.PCopies the horizontal and vertical values of point into the other two arguments.P True} BMs Q79Z?MP}q+1|3Q lpoint.get (mouse.location (), @h, @v); msg ("Mouse at " + h + " horizontal and " + v + " vertical.") truel~This verb is useful for extracting information from point values that might be sent into Frontier by an IAC-aware application.~ point.sete6έ^"x5]P brYrrs|stt|ux-ݛ,ݛ,LANDLANDb point.seta[kCY'Oe_ND ] point.set (h, v);Q[62Nv h is the numeric value representing the horizontal component of the point. v is the numeric value representing the vertical component of the point.5Creates a point made up of the two values at h and v.5 The newly created pointo$ x = 13; y = 100; scratchpad.pt = point.set (x, y) true Examining scratchpad.pt after this script executes reveals a point object with the value 13,100.KThis verb is useful for creating point values for an IAC-aware application.K point.getT^@}yʩ+R܃ buuuvvwwxݛ-ݛ-LANDLANDb editMenu.clearG<ulwGT editMenu.clear ()Tr}_yK None required%'Empzstə$蜩U :Delete the selected item, with no effect on the Clipboard.: True_TTHV=KBJ.y Open examples.docs.editText in the Object Database. Select any line of text in the window and then type and execute: editMenu.clear () true Before you leave the example, be sure to type and execute: editMenu.undo () true to leave the sample in its original condition.[ Performs the same action as selecting the Clear command from the Edit menu in Frontier. Since this verb places nothing on the Clipboard, it is faster and uses less memory than editMenu.cut. You should use this verb unless you plan to paste the information being removed from the document. The action applies to the Frontier environment only.[ editMenu.cutJ.0sVN*мf bxxxyyeyz|ݛ-ݛ-LANDLANDb editMenu.copy^1OrvV|mje:|m editMenu.copy ()ULq̪nn2K None requiredo:k[.0 -Copies the target selection to the Clipboard.-jTrue if a selection existed and was copied, false if there was no selection or if the copy process failed.jOpen examples.docs.editText in the Object Database. Select any line of text in the window and then type and execute: editMenu.copy () true Scroll to another place in the sample text window, click the insertion point there, and execute: editMenu.paste () true to confirm that the copy process worked as you expected. Make sure you dont have anything selected in the frontmost editing window containing examples.docs.editText. Now type and execute: editMenu.copy () false Notice the return value is different from the first example, above. Re-select the example text window. Execute: editMenu.paste () true Notice that the previous contents of the Clipboard are pasted into the document. Performs the same action as selecting the Copy command from the Edit menu in Frontier. The action applies to the Frontier environment only.*editMenu.cut editMenu.clear editMenu.paste*b||} }5}n}Mݛ.ݛ.LANDLANDb editMenu.cut`V," _ŃD editMenu.cut () Tj].f None required51D =R뇼 YCopies the selected item to the Clipboard and then deletes it from its original location.YfTrue if a selection existed and was cut, false if there was no selection or if the cut process failed.fdOpen examples.docs.editText in the Object Database. Select any line of text in the window and then type and execute: editMenu.cut () true Now you can scroll to another point in the document, click the insertion point there, and execute: editMenu.paste () to confirm that the cut operation worked as expected. Before you leave the example, be sure to return the sample to its original condition with the Undo command. Make sure you dont have anything selected in the frontmost editing window containing examples.docs.editText. Now type and execute: editMenu.cut () false Notice the return value is different from the first example, above. Re-select the example text window. Execute: editMenu.paste () Notice that the previous contents of the Clipboard are pasted into the document. Be sure to return the document to its original condition before proceeding.d Performs the same action as selecting the Cut command from the Edit menu in Frontier, except it leaves the Clipboard contents unmodified. Since this verb places material on the Clipboard, it is slower and uses more memory than editMenu.clear. You should use editMenu.clear unless you plan to paste the information being removed from the document. The action applies to the Frontier environment only.+editMenu.clear editMenu.copy editMenu.paste+bIuL]ݛ/ݛ/LANDLANDb editMenu.pasteΙyYmW\x[+o editMenu.paste ()Vow=LgL None required=(ȖU-uq0 Copies the contents of the Clipboard into the target window. Depending upon what is in the Clipboard and on the type of window that is the target, the pasted informations data format may be converted. True7nnna3KCS6dNZ :Open examples.docs.editText in the Object Database. Select any line of text in the window that has some styled text in it and then type and execute: editMenu.copy () true This will select some data of type TEXT. Click elsewhere in the word processing window and execute: editMenu.paste () true Notice that the copied material is placed into the document at the insertion point. Now open the outline document examples.docs.editOutline and execute again: editMenu.paste () true Notice that the text is inserted into the outline on the selected line or, if no line is selected, immediately below the line on which the cursor is located. Note, too, that it has lost its styling. This is because text in an outline does not have styles and the pasted text has now taken on the data type of the contents of an outline.: Performs the same action as selecting the Paste command from the Frontier Edit menu. If you paste the Clipboard into an outline, the pasted material is inserted as a heading immediately beneath and at the same level as the currently selected heading. The cursor remains on the pasted heading. The action applies to the Frontier environment only and depends on what kind of window is frontmost. editMenu.cut editMenu.copy]R b.Z[hݛ0ݛ0LANDLANDb editMenu.plainTextK ;R正4 editMenu.plainText ()Z:!ɑ,JT None requiredPN(Ȓy-Lqo ^Turns off all styles for the current text selection in the target word processing text window.^+True if a change was made, false otherwise.+edit (@examples.styleTest) true Select any text in the window (all of it is styled). Now type and execute: editMenu.plainText () true Notice that the text style disappears. Now type and execute: editMenu.undo () true Performs the same action as selecting the Plain Text command in the Style sub-menu of the Frontier Edit menu. This verb, like all of the others related to styled text, only works in word processing text windows, not in outlines or tables.neditMenu.setBold editMenu.setItalic editMenu.setOutline editMenu.setShadow editMenu.setUnderline editMenu.undonb.Z'ݛ1ݛ1LANDLANDb editMenu.selectAll9ۆ+rtU* editMenu.selectAll ()]yG~e None requiredyD,\}9q @Selects all items in the target window. The definition of all items depends on the type of data displayed in the target window and what is already selected, or where the cursor is positioned in that window. See The Target of Editing Commands in the EditMenu verbs chapter of the UserTalk Reference Guide for details.@ TrueԚ[6'5s@ Ɗ+ editmenu.selectAll () true  Performs the same action as choosing the Select All command from the Frontier Edit menu. The action applies to the Frontier environment only and depends on what kind of window is frontmost as well as what, if anything, is selected at the time. If the frontmost window is a word processing text window, the entire contents of the window are selected, regardless of the prior selection or cursor position. If the frontmost window is an outline, only the line on which the cursor is positioned is selected. If the frontmost window is a table, and the cursor is in a cell, the contents of that cell are selected. If an entire row has been selected previously, the contents of the Name cell are selected.b*V&Hݛ1ݛ1LANDLANDb editMenu.setBold`G >d editMenu.setBold (setting)7| setting is a boolean determining if selected text should be boldfaced (true) or have the boldface removed (false) if it is presently bold.YTurns bold style on or off for the current text selection, depending on value of setting.Y+True if a change was made, false otherwise.+edit (@examples.styleTest) true Select any line that is not bold. Now type and execute: editMenu.setBold (true) true Notice that the text is now bold. Type and execute: editMenu.undo () true Text returns to its original style. edit (@examples.styleTest) true Select the first line in the document. Now type and execute: editMenu.setBold (true) false This text was already bold, so no style change took place. Verb returns false to let you know that. Performs the same action as selecting the Bold command from the Style sub-menu of the Frontier Edit menu. This verb, like all of the others related to styled text, only works in word processing text windows, not in outlines or tables.peditMenu.plainText editMenu.setItalic editMenu.setOutline editMenu.setShadow editMenu.setUnderline editMenu.undopbeS#ݛ2ݛ2LANDLANDb editMenu.setFont4*^"3& editMenu.setFont (fontname) 2 rfontname is a string containing the name of the font as it appears in the Font sub-menu of the Frontier Edit menu.rFSets the font of the selected item to the font identified in fontname.F+True if a change was made, false otherwise.+edit (@examples.setFontTest) true Select the first line of text in the editing window. Now type and execute: editMenu.setFont ("Times") true6 Performs the same action as selecting a font from the Font sub-menu of the Frontier Edit menu. Applied to a word processing text window, this verb affects selected text or, if there is no selection, the next text entered. Applied to an outline or table window, it affects the entire contents of the window.6 editMenu.undo8ΘU@r1Z bݛ3ݛ3LANDLANDb editMenu.setFontSizeeW4 editMenu.setFontSize (size)̭ ]size is an integer value that defines the size of character to be used for the selected text.]Sets the font size of the target selection. (See The Target of Editing Commands in the EditMenu Verbs chapter of the UserTalk Reference Guide for an explanation of target.)+True if a change was made, false otherwise.+edit (@examples.setFontTest) true Select any line of text. Now type and execute: editMenu.setFontSize (24) true Notice that the font size increases to 24 on the selected line. Now type and execute: editMenu.setFontSize (12) true# Performs the same action as selecting an item from the Size sub-menu of the Frontier Edit menu. Applied to a word processing text window, this verb affects selected text or, if there is no selection, the next text entered. Applied to an outline or table window, it affects the entire contents of the window. On a Macintosh running under System 7, any integer value is legal and should produce readable output with TrueType fonts. Bitmapped fonts on any version of the system can appear hard to read if an unsupported size is applied to them.# editMenu.setFont editMenu.undou bRE@oݛ4ݛ4LANDLANDb editMenu.setItalicjh_q);di' editMenu.setItalic (setting)Vz` setting is a boolean determining if selected text should be italicized (true) or have the italics removed (false) if it is presently italicized.ZTurn italic style on or off for the current text selection, depending on value of setting.Z+True if a change was made, false otherwise.+edit (@examples.styleTest) true Select any line that is not italics. Now type and execute: editMenu.setItalic (true) true Notice that the text is now italicized. Type and execute: editMenu.undo () true Text returns to its original style. edit (@examples.styleTest) true Select the second line in the document. Now type and execute: editMenu.setItalic (true) false This text was already italic, so no style change took place. Verb returns false to let you know that.Performs the same action as selecting the Italic command from the Style sub-menu of the Frontier Edit menu. This verb, like all of the others related to styled text, only works in word processing text windows, not in outlines or tables.neditMenu.plainText editMenu.setBold editMenu.setOutline editMenu.setShadow editMenu.setUnderline editMenu.undonb 5acݛ5ݛ5LANDLANDb editMenu.setOutlineLx)D;C7 editMenu.setOutline (setting)VE setting is a boolean determining if selected text should be outlined (true) or have the outlining removed (false) if it is presently displayed in outline style.[Turn outline style on or off for the current text selection, depending on value of setting.[+True if a change was made, false otherwise.+edit (@examples.styleTest) true Select any line that is not outlined. Now type and execute: editMenu.setOutline (true) true Notice that the text is now outlined. Type and execute: editMenu.undo () true Text returns to its original style. edit (@examples.styleTest) true Select the last line in the document. Now type and execute: editMenu.setOutline (true) false This text was already outlined, so no style change took place. Verb returns false to let you know that.4 Performs the same action as selecting the Outline command from the Style sub-menu of the Frontier Edit menu. This verb, like all of the others related to styled text, only works in word processing text windows, not in outlines or tables. Do not confuse outline style with the Frontier outline datatype.4meditMenu.plainText editMenu.setBold editMenu.setItalic editMenu.setShadow editMenu.setUnderline editMenu.undombmqD&ݛ6ݛ6LANDLANDb editMenu.setShadow‹;UD editMenu.setShadow (setting)$ԍT setting is a boolean determining if selected text should be shadowed (true) or have the shadow style removed (false) if it is presently shadowed.ZTurn shadow style on or off for the current text selection, depending on value of setting.Z+True if a change was made, false otherwise.+edit (@examples.styleTest) true Select any line that is not shadowed. Now type and execute: editMenu.setShadow (true) true Notice that the text is now shadowed. Type and execute: editMenu.undo () true Text returns to its original style. edit (@examples.styleTest) true Select the fourth line in the document. Now type and execute: editMenu.setOutline (true) false This text was already shadowed, so no style change took place. Verb returns false to let you know that. Performs the same action as selecting the Shadow command from the Style sub-menu of the Frontier Edit menu. This verb, like all of the others related to styled text, only works in word processing text windows, not in outlines or tables.neditMenu.plainText editMenu.setBold editMenu.setItalic editMenu.setOutline editMenu.setUnderline editMenu.undonb+W ݛ7ݛ7LANDLANDb editMenu.setUnderlineB!"iK editMenu.setUnderline (setting)5 setting is a boolean determining if selected text should be underlined (true) or have underlining removed (false) if it is presently underlined.]Turn underlining on or off for the current text selection, depending on the value of setting.]+True if a change was made, false otherwise.+edit (@examples.styleTest) true Select any line that is not underlined. Now type and execute: editMenu.setUnderline (true) true Notice that the text is now underlined. Type and execute: editMenu.undo () true Text returns to its original style. edit (@examples.styleTest) true Select the second line in the document. Now type and execute: editMenu.setUnderline (true) false This text was already underlined, so no style change took place. The verb returns false to let you know that. Performs the same action as selecting the Underline command from the Style sub-menu of the Frontier Edit menu. This verb, like all of the others related to styled text, only works in word processing text windows, not in outlines or tables.keditMenu.plainText editMenu.setBold editMenu.setItalic editMenu.setOutline editMenu.setShadow editMenu.undokb(-,.ݛ7ݛ7LANDLANDb editMenu.undo*eUQ]TUZf editMenu.undo ()Ov)ѠTb6=Y None requiredR.!Wu4f"N /Undoes the last operation on the target window./True if the previous operation in the target window could be undone and was, false if Undo is disabled and therefore could not be performed.Open examples.docs.editText in the Object Database. Select any line of text in the window and then type and execute: editMenu.cut () true Note that the selected text has been removed. Now type and execute: editMenu.undo () true Note that the cut is undone and the text is restored. Try it again: editMenu.undo () true Now the text is cut again. Many of the content-editing commands place the undo feature of Frontier into a toggle mode where each execution of editMenu.undo returns the document to its previous state. Performs the same action as selecting the Undo or the corresponding Redo command in the Frontier Edit menu. This verb, like its menu equivalent, often acts as a toggle, undoing and re-doing a specific change. Frontier keeps separate track of the last change made in each window during a Frontier session. This permits you to undo the last sequence of questions if they are performed on different objects.b=ihݛ8ݛ8LANDLANDb kb.cmdKey͕učL^0!!1 kb.cmdKey ()2D @9R None required.7X6%GO\k+ 8Determines whether the Command key is now being pressed.8:True if the Command key is being pressed, false otherwise.:\Locate a script called examples.WatchKeys. Copy it. Now use the UserLand menus Agents sub-menu to Open Agents Table. Now paste the script using the Paste command from the Edit menu or by typing CommandV. If background processes are turned on, you will now be told every time Frontier detects you pressing the Command key. When you are done experimenting, be sure to delete system.agents.WatchKeys; otherwise, youll find yourself being interrupted often when you are using Frontier. edit (@Frontier.finder2Click) Examine this script. You can see how it uses the kb.cmdKey verb to change its behavior.\bÜ dĪ~ݛ9ݛ9LANDLANDb kb.controlKey>Au4Kfk,K kb.controlKey ()vٖ<> None required.q_0Y ݽ 8Determines whether the Control key is now being pressed.8:True if the Control key is being pressed, false otherwise.:Locate a script called examples.WatchKeys. Copy it. Now use the UserLand menus Agents sub-menu to Open Agents Table. Now paste the script using the Paste command from the Edit menu or by typing CommandV. If background processes are turned on, you will now be told every time Frontier detects you pressing the Control key. When you are done experimenting, be sure to delete system.agents.WatchKeys; otherwise, youll find yourself being interrupted often when you are using Frontier.bǀǬHȎݛ:ݛ:LANDLANDb kb.optionKeylD@-s kb.optionKey ()d % t(DNG None required. -F%2)A]T 7Determines whether the Option key is now being pressed.79True if the Option key is being pressed, false otherwise.9Locate a script called examples.WatchKeys. Copy it. Now use the UserLand menus Agents sub-menu to Open Agents Table. Now paste the script using the Paste option from the Edit menu or by typing CommandV. If background processes are turned on, you will now be told every time Frontier detects you pressing the Option key. When you are done experimenting, be sure to delete system.agents.WatchKeys; otherwise, youll find yourself being interrupted often when you are using Frontier.bDp˳Jݛ:ݛ:LANDLANDb kb.shiftKey ElF~Xt+Tu&*뫵 kb.shiftKey ()ƶ]oPPZ1 None required.2J@QZw9H 6Determines whether the Shift key is now being pressed.68True if the Shift key is being pressed, false otherwise.8Locate a script called example.WatchKeys. Copy it. Now use the UserLand menus Agents sub-menu to Open Agents Table. Now paste the script using the Paste option from the Edit menu or by typing CommandV. If background processes are turned on, you will now be told every time Frontier detects you pressing the Shift key. When you are done experimenting, be sure to delete system.agents.WatchKeys; otherwise, youll find yourself being interrupted often when you are using Frontier.bT΀ά^ݛ;ݛ;LANDLANDb pict.expressionsVC.Fy_l pict.expressions (boolean) `;3 boolean is true or false.!Enc" aDetermines whether expressions contained in the drawing in the target window should be evaluated.a True '&-c@C'"*ˎ̈8 pict.expressions (true) true This verb is only meaningful with pictures that contain text objects that involve expressions. Expressions begin with the equals character (=).bѸ<ҩ\ݛ;ݛ;LANDLANDb pict.getPicture)\o4`4: pict.getPicture (addr)Q `' jaddr is the address where the picture in the target picture window is to be stored as a binary PICT value.j\Copies the picture in the target window to the location specified by addr as a binary value.\ True 8uX%pEM@D E߇d :pict.getPicture (@people.[user.initials].testPict) true:oThe binary value created by this verb contains a standard Macintosh picture, and has a embedded type of 'PICT'.o"pict.setPicture pict.pictureToPICT"b 7cAmճ.ۆݛ<ݛVe >}Ǫ!|fjǪ examples.picture2 contains a picture stored in Macintosh PICT format. Create a Frontier version of it in your people table with this line, typed and executed in the Quick Script window: pict.PICTToPicture (@examples.picture2, @people.[user.initials].testPict) trueIf addr2 does not exist, this verb will create it. This verb is implemented as a script. Picture objects can exist in two forms in Frontier: binary PICTs and Frontier pictures. Binary values containing the data of a Macintosh PICT cannot be viewed in their own window. This verb is designed to create a Frontier picture object containing the binary picture data so that it can be viewed."pict.PictureToPICT pict.setPicture"b#׿؀جXݛ=ݛ=LANDLANDb pict.PictureToPICTC-.j) !pict.PictureToPICT (addr1, addr2)!vaddr1 is the address of a Frontier picture object. addr2 is the address where you wish to store the converted picture.vConverts the graphic object stored in the Frontier picture at addr1 to Macintosh PICT (binary) form and stores the result at addr2. (See "Notes," below for details.) Trueօ^pbV :WcA`nԚ  examples.picture contains a picture stored in Frontier picture format. Create a PICT version of it in your people table with this line, typed and executed in the Quick Script window: pict.PictureToPICT (@examples.picture, @people.[user.initials].testPict2) true If addr2 does not exist, this verb will create it. This verb is implemented as a script. Picture objects can exist in two forms in Frontier: binary PICTs and Frontier pictures. Macintosh PICTs are a component of a Frontier picture object. This verb is designed to extract the graphic stored in a Frontier picture so that the PICT data itself can be passed to another application or placed on the clipboard."pict.PICTToPicture pict.getPicture"b M݁ݭiʩݛ=ݛ=LANDLANDb pict.scheduleUpdate8VعH^ pict.scheduleUpdate (seconds)ԑ useconds is a number specifying the number of seconds to be established as the update interval for the target picture.uEstablishes seconds as the frequency at which the target picture will recalculate any expressions it contains and update its display. True:etPj$n'NRUis=}% pict.scheduleUpdate (13) true This verb is relevant only to picture windows displaying pictures which in turn contain expressions. Expressions are text objects that begin with an equals sign, followed by a valid UserTalk expression. pict.expressions˭AY1̮+ b1]o<ݛ>ݛ>LANDLANDb pict.setPicture:VO+zfO pict.setPicture (value)@Jv; Evalue is a binary value representing a picture stored in PICT format.E\Changes the contents of the target picture window to a Macintosh picture contained in value.\ True(mfwjĪuCfsk! 9pict.setPicture (people.[user.initials].testPict) true9GThis verb only operates on a target window containing a picture object.G#pict.getPicture pict.PICTToPicture#b8dIu ݛ?ݛ?LANDLANDb window.bringToFrontbA|g!( window.bringToFront (title)ƣ +title is the name of a window that is open.+kBrings the window to the front of the display. If no window with the title is open, this verb does nothing.kFTrue if the window was open and brought to the front, otherwise false.FOpen the examples table and the sub-table funStuff. Place the funStuff window atop the examples window and then type and execute: window.bringToFront (@examples) address is coerced to full Object Database path true In the following example, we use a string for the title. Type and execute: window.bringToFront ("examples.funStuff") true Close the funStuff window. Type and execute: window.bringToFront (@examples.funStuff) false The window is not open, so this verb cannot bring it to the front. Be sure that the examples and examples.funStuff windows are closed. Now type and execute: window.open (@examples.funStuff); window.open (@examples); window.bringToFront (@examples.funStuff) trueoAttempting to bring to the front a window that is not open returns false but does not produce an error message.ojThe full path name of the object in the database is also the title of the window in which it is displayed.j window.open window.sendToBackƦ b9T^ݛ@ݛ@LANDLANDb window.close@b[8u*"CCbA window.close (title)z\\_ +title is the name of a window that is open.+TCloses the window if it is open. If the window is not open, this verb has no effect.TNTrue if the window is open and can be closed, false if the window is not open.NWith the examples table open, type and execute: window.close ("examples") true Now execute the same line again. This time, the verb returns false because the window is already closed.yAttempting to close a window that is already closed results in a return value of false but no error message is generated.y This verb cannot be used to close the Main Window, since that would cause the database to be closed and the script to be terminated. If this is desired, use FileMenu.close instead of window.close. Windows remember their last location, size, and selection when they are re-opened.3window.open window.show window.hide FileMenu.close3bdSsݛ@ݛ@LANDLANDb window.dbStats[