on selectParts
-- Group selection: click on parts
-- Set card script to catch mouseDown and eat mouseUp
global saveCardScript,selectedParts,selectedPartsCard
put empty into selectedParts
put long name of this card into selectedPartsCard
put script of this card into saveCardScript
choose browse tool
put "Click on the parts you wish to select. Press enter to stop."
-- write a script
put "on mouseDown" & return into scriptVar
put " global selectedParts" & return after scriptVar
put " put the shiftKey is down into deselectFlag" & return after scriptVar
put " if " & quote & "button" & quote & " is not in the target and " & quote
& "field" & quote & " is not in the target" & return after scriptVar
put " then put " & quote & "There is no part there." & quote & return after
scriptVar
put " else" & return after scriptVar
put " get the target" & return after scriptVar
put " if " & quote & "id" & quote & " is not word 3 of it" & return after
scriptVar
put " then put " & quote & "id " & quote & " & id of the target into last
word of it" & return after scriptVar
put " if deselectFlag then" & return after scriptVar
put " if it is not in selectedParts" & return after scriptVar
put " then put the target & " & quote & " is not selected." & quote &
return after scriptVar
put " else" & return after scriptVar
put " put offset(it & return,selectedParts) into startChar" & return
after scriptVar
put " delete char startChar to startChar + length(it) of
selectedParts" & return after scriptVar
put " put the target & " & quote & " is now deselected." & quote &
return after scriptVar
put " end if" & return after scriptVar
put " else" & return after scriptVar
put " if it is in selectedParts" & return after scriptVar
put " then put the target & " & quote & " is already selected." & quote
& return after scriptVar
put " else" & return after scriptVar
put " put it & return after selectedParts" & return after scriptVar
put " put the target & " & quote & " is now selected." & quote &
return after scriptVar
put " end if" & return after scriptVar
put " end if" & return after scriptVar
put " end if" & return after scriptVar
put " exit to HyperCard" & return after scriptVar
put "end mouseDown" & return after scriptVar
put return after scriptVar
put "on doneSelecting" & return after scriptVar
put " global saveCardScript,selectedParts" & return after scriptVar
put " set script of this card to saveCardScript" & return after scriptVar
put " put the number of lines in selectedParts & " & quote & " parts
selected" & quote & return after scriptVar
put "end doneSelecting" & return after scriptVar
put return after scriptVar
put "on closeCard" & return after scriptVar
put " doneSelecting" & return after scriptVar
put "end closeCard" & return after scriptVar
put return after scriptVar
put "on enterKey" & return after scriptVar
put " doneSelecting" & return after scriptVar
put "end enterKey" & return after scriptVar
set script of this card to scriptVar
end selectParts
This article is adapted from the Claris Tech Info database.