Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.
put expression
put expression preposition ¬
[chunk of] container
put menuItemList preposition ¬
[menuItem of] menu ¬
[with menuMessages messageList]
The put
command evaluates an expression and places the value it extracts into
, after
, or before
the contents of a container.
The container can be a button, a field, a variable, the Message box, the selection, a chunk
expression, or a menu. If you don’t specify a container, HyperCard puts the value into the Message box, showing it if it’s hidden.
Use put
with into
to replace the contents of a container or menu, with before
to place the value at the beginning of its contents, and with after
to append the value to the end of its contents.
The lines of text that you put into a pop-up button become the items of the menu that appears when you click the button.
Before you can add items to a menu, the menu must already exist.
The menuItemList
is a comma-separated list of the items you want to add to the menu. Use the single character "-"
to get a gray line. You can put up to 64 items into a menu with a single put
statement.
The optional messageList
is a comma-separated list of message names that HyperCard sends to the current card when the user chooses one of the menu items. The number of items in the messageList
must equal the number of items in menuItemList.
To skip a message name, use an empty item—a null between two commas:
"myMessage 1,,myMessage 3"
-- These are equivalent:
put 42.5 * 675
put 42.5 * 675 into msg
put 42.5 * 675 into the Message box
put empty into It
put "Hello" into field 1
put "Go: " before field "WhereTo"
put "." after last character of last word of field 3
put the date into varName
put the clickLine into theLineClicked
put the value of the clickLine into theTextClicked
put "*" after the selection
-- Add items to a menu:
create menu "Example"
put "1,2,3,-,4,5,6" into menu "Example"
put "7" after menu "Example" with menuMessage "beep"
put "a,b,c,-" before menu "example" ¬
with menuMessages "beep,beep 2,beep 3,empty"
-- add items to a button
put "Boston" & return & "New York" & return & "Salem" into button "Maps"
on putDemo
get bkgndFields()
if the number of chars of it < 255 then answer it
end putDemo
function bkgndFields
-- Returns a return-delimited list of the bg fields
repeat with i = 1 to the number of bkgnd fields
put the short name of bg field i & return after theFields
end repeat
return theFields
end bkgndFields
true
sin(90)
"this is" && it
(3+2) = 5
the heapspace div 1024
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.into
before
after
ordinal
charactercharacter posInteger [to posInteger
]ordinal wordword posInteger
[to posInteger
]ordinal itemitem posInteger
[to posInteger
]ordinal lineline posInteger
[to posInteger
]first character
second item
middle line
character 1
char 1 to 10
word 3
item 5 to (the number of items of me)
line 1 to 10
char 1 to 10 of word 2 to 4 of ¬
line 3 to 6
A chunk combined with of
and a container is called a chunk expression. For example:
line 1 of card field "index"
myVariable
[the] selection
the Message box
btn 3
bg btn "Names"
card field 1
bkgnd field "Total"
menu 2
menu "Edit"
Additionally, you can refer to a button or field by its part number:card part 1
last background part
AppleScript DefinitionAn object that contains one or more other objects, known as elements of the container. In a reference, the container specifies where to find an object. You specify containers with the reserved words of
or in
.'s
) to specify containers. For example, infirst window's name
the container is first window
. The object it contains is a name property. -
” to get a gray line.
"Back,Home,Help,Recent,-," & ¬
"First,Prev,Next,Last"
See also: messageList.
menuItem text
menuItem posInteger
ordinal menuItem
For example: menuItem "New"
menuItem 2
second menuItem
menu text
menu posInteger
ordinal menu
For example: menu "File"
menu 2
second menu
menuItemList.
empty
to indicate no message in HyperTalk, or ""
to indicate no message in AppleScript.
"go back,go home,help," & ¬"go recent,empty," & ¬"go first,go prev,go next," & ¬"go last"
Commands
Version 0.7b1 (March 24, 2022)