Page 1 of 1

File handling and opening

Posted: Mon Dec 17, 2018 6:20 pm
by uschoell
Hello, I'm a newbee to livecode and after several hours of trial and error, I finaly could not solve my issue maybe someone can help me with some lines of scrpting:

I managed to set a directoty path and put its content (filenames) into a field. Now I like to select a file ot of the list in the field and open that file (e.g. a CSV file) and put its content into a field to add some data with other activities. How can a filename be selected out of a list in a filed and then opend?

Thanks 4 ur help.
Best regards
Uli.

Re: File handling and opening

Posted: Mon Dec 17, 2018 7:22 pm
by Klaus
Hi Uli,

welcome to the forum!

Uli sounds very german, if you are german, there is also a german LC forum here:
http://www.livecode-blog.de/forums/foru ... ode-forum/

I presume you are talking about a list field that displays all your fielnames?
In that case use this script:

Code: Select all

on mouseup
  put the selectedtext of me into tSelection

  ## User clicked somehwere on the field, but did not select a line:
  if tSelection = EMPTY then
    exit mouseup
  end if

  ## tSelection now contains the selected text
  ## I presume "the defaultfolder" is set to the folder containing all these files?
  ## if yes, you can:
  put url("file:" & tSelection) into fld "your field for file display here"
end mouseup
You get the picture. :D

Best

Klaus