<script>-- this button can have one of two names and is set by the bg scripton mouseUpput empty into bg fld "Diag"do connectend mouseUp</script>
</part>
<part>
<id>110</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <true /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>75</left>
<top>2</top>
<right>316</right>
<bottom>21</bottom>
</rect>
<style>shadow</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>hostname</name>
<script></script>
</part>
<part>
<id>111</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <true /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>74</left>
<top>27</top>
<right>271</right>
<bottom>45</bottom>
</rect>
<style>shadow</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>users</name>
<script></script>
</part>
<part>
<id>112</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>317</left>
<top>2</top>
<right>337</right>
<bottom>20</bottom>
</rect>
<style>shadow</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>11893</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Host List</name>
<script>-- Display the Host List pop-up menu.-- Select an entry and it will be put into the Host Name field and-- the Connect button will be pressed. Select Edit Host List from the-- menu to modify the menu contents.on mouseDownput bg fld "HostName" into HostNameif HostName is not emptythen put "!" & NumToChar(18) & HostName & ";-;" into HostNameput cd fld "Host List" of card "Host List" into HostListput HostList into xHostListif HostList is not empty then put ";-;" after xHostListget PopUpMenu( HostName & xHostList & "<IEdit Host List…", empty, ¬left of card window + left of me + 1, ¬top of card window + top of me + 1 )if it is empty then exit mouseDown -- no menu item was chosenif HostName is not empty then subtract 2 from itif it < 1 then get bg fld "Host Name"else get word 1 of line it of HostList -- get the host nameif it is empty then -- edit host list?visual effect iris open fastgo card "Host List"elseput it into bg fld "HostName"if the optionKey is not down then autoConnectend ifend mouseDownon mouseUp-- don't send mouseUp to bgend mouseUp</script>
</part>
<name>Main</name>
<script>---- HyperFinger background script.-- September 1991 J. Michael Cherry (cherry@frodo.mgh.harvard.edu)---- About 99% of the HyperTalk code in this stack is-- from HyperFTP by Douglas Hornig © 1990 Cornell University---- The XCMDs and XFCNs used here are:-- TCPNameToAddr, TCPSend, TCPRecvUpTo, TCPState, TCPRelease, TCPClose,-- and TCPPassiveOpen by Harry Chesley © 1989 Apple Computer, Inc.---- PopUpMenu by Andrew Gilmartin © Brown University 1989------ Any praise you have for this stack should go to Douglas Hornig and-- Harry Chesley.--on idleglobal connID, diagTxt-- Check the status of the communications connectionif connID is emptythen get "no connection" else get TCPState( connID )checkState itif it is not "established" then exit idleend idle-- Handle changes in the communications stateon checkState theStateglobal connID, diagTxt, diagScrollif theState = bg fld "State" then exit checkState -- no status changelock screenif theState contains "Close" thenTCPClose connIDTCPRelease connIDput empty into connIDend ifput theState into bg fld "State"unlock screenend checkState-- Initialize various thingson openStackglobal connID, TextCreatorlock screenput empty into connIDput empty into bg fld "State" -- set "no connection" state on idleif item 2 of the loc of card window ≤ 20 then hide menuBarhide msg boxend openStack-- Finish up various thingson closeStackglobal connIDif connID is not empty thenTCPRelease connIDput empty into connIDend ifif the freeSize of this stack ≥ 40960 then -- 40K free space?diagMsg emptydiagMsg "Compacting the stack…"put the userLevel into saveLevelif saveLevel < 3 then set the userLevel to 3send "doMenu Compact Stack" to HyperCardset the userLevel to saveLevelend ifshow menuBar -- restore the menuBar in case we hid itend closeStack-- Send some text (with return & linefeed) over comm. connectionon sendLine textglobal connIDTCPSend connID, text & return & linefeedend sendLine-- Pressing return is like clicking on the Connect btn.on returnKeyautoConnectend returnKey-- The return key was pressed or the Connect button clicked.on autoConnectif the short name of bg btn id 102 is "Connect" thenset the hilite of bg btn id 102 to truewait 5 ticksput empty into bg fld "Diag"set the hilite of bg btn id 102 to falsesend "connect" to bg btn id 102end ifend autoConnect-- establish a connection with a Finger serveron connectglobal connID, TextCreator-- Finger server hostnameif bg fld "Hostname" is empty thendiagMsg "You must enter an Internet Hostname in the Hostname field above."exit connectend ifput bg fld "Hostname" into HostName-- Start the connection by first resolving the HostNamediagMsg "Finding the address for host ‘" & HostName & "’" & returnset cursor to busy -- this may take a while…get TCPNameToAddr( HostName )if char 1 of it is "§" thenif it contains "couldn't open resource"then diagMsg "MacTCP™ has not been installed."else diagMsg "Can't get the IP address for ‘" ¬& HostName & "’"exit connectend ifput empty into bg fld "Diag"put "Waiting" into fld "State"-- Socket number 79 is the Finger TCP serviceput TCPActiveOpen( item 1 of it, 79, 0 ) into connIDif connID contains "fail" thendiagMsg connIDput empty into connIDexit connectend ifput "Established" into fld "State"-- Send the remote host the finger requestput bg fld users into tempsendline temp && returnrepeat foreverget TCPRecvUpTo( connID, linefeed, zero, empty )if it ≠ empty thenif char 1 of it is "§" then exit repeatput length of it into reclenif char reclen of it = numtoChar(10) thenput empty into char reclen of itend ifDiagMsg itset cursor to busyend ifend repeatend connecton diagMsg theMsgput theMsg after bg fld "Diag"end diagMsg</script>