on 16/10/01 5:47 PM, Scott Raney at [EMAIL PROTECTED] wrote:

> You didn't check the result after the "answer file", so you don't know
> if there was a cancel or some other error (in which case "it" indeed
> won't be changed).

Scott,

Thanks for responding to this.

a) I did check the result in my real code (not, I admit when I first wrote
it, but in the course of investigating this problem).  I stripped the code
down in my message to the list.

b) I can assure you that as I was testing over and over again to reproduce
the problem and try to find a way round it, and I was not selecting cancel,
and I was selecting the file.  I can't now state absolutely that the problem
did not coincide with a case in which the result was non-empty; but I can
definitely say that it was not a user cancelling.  (I've restored some code
which after these calls to answer file reports both the result and the value
of 'it' - when the problem recurs (it's intermittent) I'll be able to answer
this definitively.)

c) the documentation for "answer file" states:

    The absolute file path of the file the user chose is placed in the
    it variable. If the user cancels the dialog, the it variable is set
    to empty, and the result function returns cancel.

(This is the Revolution documentation - the Metacard documentation is not
explicit - it states that the result will be set to cancel if the user
cancels, but doesn't say that 'it' will or will not be set in that case).

If this is a documentation error - shouldn't "answer file" work this way (ie
set it to empty if the user cancels)?  Obviously this is a nasty potential
gotcha for anyone importing stacks from HyperCard.  But more generally, why
should this function, sometimes leave "it" in an indeterminate state?
Surely it's reasonable to think that the commands "get", "ask", and "answer"
should all set "it" to something; just as "put" should never leave the
destination unchanged?

In practise, it appears that answer file does work in this way. In a quick
test (in Rev) on a new stack, with this script on a button:
    on mouseUp
     get 23
     answer file "Where's my lunch"
     answer it & return & the result
    end mouseUp

"it" is set to empty even if you cancel (in which case 'the result' is
"cancel").

So,

Can you confirm - should "it" get set to empty if the user cancels or there
is some other problem, or are there cases in which we can expect "it" to be
left unchanged (and the result to be non-empty)?

If the former - this may be part of the answer to my problem - there is then
some further problem to investigate as to why answer file on two different
Macs sometimes gets into a state in which it quite frequently has an error,
although the user has selected a file.

If the latter - then my problem is still as I stated it: a bug in the answer
file code in which "it" is not set.
 
  Ben Rubinstein               |  Email: [EMAIL PROTECTED]
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866


Reply via email to