pbiron@weber.ucsd.edu (Paul Biron) (03/26/90)
One of the most annoying things about HyperTalk is that there is no exists() function. By this I mean something that could be used in the following mannor : on foo repeat with cardNum = 1 to the number of cards if exists("card button bar") then set the rect of card button bar to 100,200 else put "card button bar does not exist on" && -| the long name of this card end repeat end foo Sure, this can be simulated by : function exists object put word 3 to word the number of words in -| object of object into objectName if word 1 of object is "card" then if word 2 of object is "button" then repeat with i = 1 to the number of card buttons if the short name of card button i -| is objectName then return true end repeat else if word 2 of object is "field" then ... else .... end exists but this is highly inefficient, and not very general (what about "cd btn bar", "btn number X", etc.). Does anyone know of a better way to do this? Perhaps an XFCN? My first guess is that there is no such external, since the file structure of stacks has not been made public, and one would have to be reading the file structure to do something like this. I know its too late, but my wish list for the next release of HyperCard contains such a function. Paul Biron (pbiron@ucsd.edu) (619) 534-5758 Social Sciences DataBase Project, Central University Library University of California, San Diego La Jolla, Ca. 92093
mmt@dciem.dciem.dnd.ca (Martin Taylor) (03/27/90)
Paul Biron wants to know whether there exists an XFCN that can determine whether an obejct exists. Yes, this object exists. It is called ObjectExists, and is in the Dartmouth XCMDs 3.1 stack. It checks for the existence of any object of a type known to Hypercard. Here are the examples from the bottom of the information field: get ObjectExists("card field Watusi") get ObjectExists("bg btn 15") get ObjectExists("card id 2731") get ObjectExists("stack home") get ObjectExists("background WildCard") Don't ask me where I got the stack. It was either on comp.binaries.mac or from the sumex archives. The stack is freely distributable, but it you want to use the source code, documentation, or Mac resources commercially, you must communciate with Office of Industrially Sponsored Research P.O. Box 7 Dartmouth College Hanover, NH 03755 -- Martin Taylor (mmt@zorac.dciem.dnd.ca ...!uunet!dciem!mmt) (416) 635-2048 "Viola, the man in the room doesn't UNDERSTAND Chinese. Q.E.D." (R. Kohout)
pbiron@weber.ucsd.edu (Paul Biron) (03/27/90)
Thanx to everyone who replied to my quest for an exists(object) function. The overwhelming concensus is that the Dartmoth 3.1 stack (available from sumex) has just such a function in it. Thanx again, Paul Biron (pbiron@ucsd.edu) (619) 534-5758 Central University Library, Social Sciences DataBase Project University of California, San Diego La Jolla, Ca. 92093
baum@Apple.COM (Allen J. Baum) (03/28/90)
[] >In article <2308@network.ucsd.edu> pbiron@weber.ucsd.edu (Paul Biron) writes: >One of the most annoying things about HyperTalk >is that there is no exists() function. By this >I mean something that could be used in the >following mannor : An XFCN called objectexists can be found in the Dartmouth XCMDs stack -- baum@apple.com (408)974-3385 {decwrl,hplabs}!amdahl!apple!baum