Commands

delete

Supported By

Syntax

delete object

Object yields the descriptor of the object to be deleted.

Examples

delete line 1 of steve
delete char 1 to 5 of line 4 of bill
delete file "MyTemp"

Description

The delete command deletes an object or removes a chunk from a container.

Script

The following example finds and deletes a name from a line-delimited list of names:

on zapaName
  put "Maller\nCalhoun\nWinkler" into list
  ask "Delete which name from the list?" with empty
  repeat with count = the number of lines in list ¬
      down to 1
    if it is line count of list then ¬
    delete line count of list
  end repeat
  put list
end zapaName

Notes

Using the delete command to delete a chunk is not the same as using put empty into with the same chunk. For example, if you delete a line with a statement like:

delete line 4 of myText

you delete the line break as well as the text; what was previously the fifth line becomes the fourth. The following statement leaves the line break in line 4:

put empty into line 4 of myText

HyperTalk only supports the deletion of chunks, menus, menuItems, and parts (buttons and fields).

See Also

create, put