 |
THE HYPERCARD CENTER |
|
|
Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.
requestrequest expression from|of program ¬ program request expression from|of ¬ program id programID request expression from|of ¬ this program request appleEvent data|class|id| ¬ sender|return id|sender id request appleEvent data ¬ with keyword aeKeyword
Expression yields an expression understandable to the target program.
From and of are interchangeable.
Program yields a valid program path name in the form
zone:targetComputer:targetProgram
where targetProgram is the name of a program running on computer targetComputer in network zone zone . ProgramID is the application’s signature. AeKeyword is an Apple event keyword. The request command sends an “evaluate expression” Apple event from HyperCard to another application. You can use this command to send an expression to any program that understands the standard eval Apple event. The expression you use must be understandable to the target program. For example, if the target program is another HyperCard, the expression can be any valid HyperTalk expression. When the target program executes the statement, the result of the request (the value of the expression) goes into the local variable it . If the target program reports an error, HyperCard sets the result with an error message. You use the request appleEvent forms to examine the data and attributes of an incoming Apple event. You can omit the zone parameter from the program path name when the target computer is in the same zone as the source computer. You can omit the targetComputer parameter if the target program is running on the same computer as HyperCard. You can pass the user selection from the answer program command as the program parameter. Examplesrequest "the number of cards" from program "KZone:PMac:HyperCard" request "the name of this stack" of program "HyperCard" request "{target}" from program "MPW Shell" The following handler shows how the request command can get information from another HyperCard program: on getStackName -- handler in source stack global HildaPath -- path to another HyperCard request "the long name of this stack" ¬ from program HildaPath if the result is empty then answer "Now browsing stack:" && it else answer "An error occurred:" && the result end getStackName
Demo Scripton tellTheStack -- this demo only works with System 7 if not systemSeven() then exit tellTheStack request "the name of this stack" of program ¬ (the short name of HyperCard) answer "This is" && it & "." end tellTheStack function systemSeven return the systemVersion ≥ 7.0 end systemSeven
Related Topics Placeholders
expressionHyperTalk Definition Any HyperTalk expression. All expressions evaluate to text, a number, or a constant. For example: true sin(90) "this is" && it (3+2) = 5 the heapspace div 1024
Note: Formally, HyperCard distinguishes between factors (simple values) and expressions. The difference between factors and expressions matters only if you like to drop parentheses. Most functions take factors as their parameters, which is why length of 3 + 5 returns 6 and length of (3 + 5) returns 1 . In short, always use parentheses to group things the way you want them to evaluate, and you won’t have to worry about the difference between factors and expressions. AppleScript Definition Any series of words that has a value.
HyperTalk Reference
|