Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!diemen!lin From: lin@diemen.utas.edu.au (Zhen Jie Lin) Newsgroups: comp.sys.mac.hypercard Subject: Re:Pasting text with tabs into a field: How is it done? Message-ID: <1781@diemen.utas.edu.au> Date: 10 Oct 90 05:50:10 GMT Reply-To: lin@diemen.utas.edu.au (Zhen Jie Lin) Organization: Computing Centre, University of Tasmania, Australia. Lines: 59 Bjorn Levidow write: >I'm trying to use the FileToField XCMD in the Dartmouth 3.1 collection >to put a text field with tab in it into a field. The problem is that >all of the tabs get stripped out and I'm left with one long line of data. >I'd like to be able to replace the tabs with spaces or commas if possible. >I've tried to write a TabKey handler in the field, but that produces some >strange results. Any and all help would be appreciated. Thanks in advance. The following is one way to copy data with tabs from external file into a text field in HC, by replacing comma (or anything else) with tabs: on doMenu x global finishDoMenu put false into finishDoMenu if x is "paste text" then tabToComma if finishDoMenu then exit doMenu pass doMenu end doMenu on tabToComma global finishDoMenu send "doMenu paste text" to hyperCard if the visible of the message then --check whether pasting into msg box put the rect of the message into box put item 1 of box into x1 put item 3 of box into x2 put item 2 of box into y1 put item 4 of box into y2 put item 1 of the clickLoc into x put item 2 of the clickLoc into y if x>=x1 and x<=x2 and y>= y1 and y<=y2 then put true into finishDoMenu --skip pasting data into msg box exit tabToComma end if end if put the Number of the selectedField into fldNo get the name of the selectedField if word 1 of it is "card" then --paste data into cd fld repeat until offset(tab,cd fld fldNo) = 0 put "," into char offset(tab,cd fld fldNo) of cd fld fldNo end repeat else --paste data into bg fld repeat until offset(tab,fld fldNo) = 0 put "," into char offset(tab,fld fldNo) of fld fldNo end repeat end if put true into finishDoMenu ***** Hope this helps. Zhenjie Lin University of Tasmania Australia .