problem importing tab delimited text files

Richard Gaskin ambassador at fourthworld.com
Sat Jan 15 18:37:12 EST 2011


Ian McKnight wrote:

> Thanks for the advice David. I went back and checked. As I still had the
> text file open in Excel when I was trying to import it into LC the file must
> have been locked in some way by Excel - as soon as I closed the file in XL
> it worked perfectly. Makes perfect sense really.
>
> I think I'll start writing down my gaffs down in a notebook to try and save
> time in future :)

Why write them down when you can have LiveCode write them for you? :)

If you check "the result" after a command is run, a non-empty value will 
usually contain an error string.

If you also include a call to the sysError function, you get the 
system's error code to guide you to the specifics of the error.

And if you include all that in a handler call, you only need to write it 
once, e.g.:

on SomeHandler
   ...
   put url ("file:"& tMyExportedDataFile) into tData
   Err the result
   ...
end SomeHandler

on Err s
   if s is not empty then
     put sysError() into tSysError
     answer "An error occured: "& s &"(" &tSysError& ")"
     exit to top
   end if
end Err


--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv




More information about the Use-livecode mailing list