content of ask file

Ken Ray kray at sonsothunder.com
Sat Nov 11 20:09:12 EST 2006


On 11/11/06 5:54 PM, "Scott Morrow" <scott at elementarysoftware.com> wrote:

> After presenting the < ask file > dialog what would be the best way
> to determine what the user typed?
> 
> If they enter a slash "/" as part of the file name then getting item
> -1 of it  won't work.
> 
> Perhaps my question should be:
> 
> How might I keep the user from entering a slash as part of the file
> name?
> Or, how do other folks deal with this?

Here's a way you can use:

on mouseUp
  ask file "Enter a file path:"
  put it into tPath
  if tPath <> "" then
    if there is a folder (item 1 to -2 of pPath) then
      -- code if a good path
      answer "OK"
    else
      -- code if a bad path
      answer "Bad path"
    end if
  end if
end mouseUp

HTH,

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





More information about the use-livecode mailing list