value of variable

Ken Ray kray at sonsothunder.com
Tue Sep 28 21:28:09 EDT 2004


On 9/28/04 5:42 PM, "Hershel Fisch" <hershrev at realtorsgroup.us> wrote:
> on mouseUp
>    answer "What kink of file are you putting ?" with "Tab Delimited" and
> "Comma Delimited" and "Cancel"--and on
>    put word 1 of it into sFileType
>    if sFileType is "cancel" then
>      exit mouseUp
>    else
>      answer file "a"
>      put it  into fld "f1"
>      do " put URL" & quote & "file:"& it & quote &" "&"into fld" &" "&
> quote & "f1" & quote
>      replace sFileType with "'" in fld "f1"
>    end if
> end mouseUp

Hershel, your code above puts the path from 'answer file' into fld "f1", and
then puts the contentes of the file into the same field, overwriting it. You
don't need to do that. You also don't need to do the replace action on the
data *in* the field; it's best to do it in a variable first. To use the
string that came back from the first "answer", you need to use "do" to
resolve it to a variable and not a string. Something like this:

  answer file "a"
  if it <> "" then
    put url("file:" & it) into tData
    do "replace" && sFileType && "with" && quote & "'" & quote in tData
    put tData into fld 1
  end if

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list