|
|
|||||||
I would think if MessageBox was used correct, it would give error 0 Code: If NOT @LOGONMODE Shows on screen: Code: Return Value: 1 |
||||||||
|
|
|||||||
Value Meaning -1 User did not respond to the dialog box within the specified time-out period. 1 OK button selected. 2 Cancel button selected. 3 Abort button selected. 4 Retry button selected. 5 Ignore button selected. 6 Yes button selected. 7 No button selected |
||||||||
|
|
|||||||
witto, you are correct. it's an oddity and should be fixed. |
||||||||
|
|
|||||||
I know, but I clicked OK. I would expect error value = 0 |
||||||||
|
|
|||||||
Thanks |
||||||||
|
|
|||||||
Jooel, I did not know if this was "works as designed" or really an issue. Should I repost this in the Beta forum? |
||||||||
|
|
|||||||
this was discusses some years back, iirc. could have been some other function too, though. but honestly, I think it's a bug, even if it works as designed as it doesn't work as expected. be my guest and copy your original post to beta. |
||||||||
|
|
|||||||
Post to suggestions, not beta. |
||||||||
|
|
|||||||
good point les. to avoid any flames... |
||||||||
|
|
|||||||
Interesting one. The manual doesn't state what @ERROR will be, but I agree that it might be more sensible for it to be used to indicate that KiXtart couldn't raise the window because (say) the PC is out of memory. |
||||||||
|
|
|||||||
IMHO, the @Error does not have to be documented for MessageBox seperately. It is all in Appendix B. @Error must just follow the Error codes as listed on the Microsoft Developer Network: System Error Codes . |
||||||||
|
|
|||||||
I agree with that. |
||||||||
|
|
|||||||
Indeed. In that case you will want to be doing something about Get as well |
||||||||
|
|
|||||||
Good point. I read it. But this is IMHO a good workaround to catch special keys. About Get: I think it could be stored in the Return Value, but it should be recognisable. p.e. change the type that is outputted to an Array. Store in place 0 the Value Store in place 1 the KeyCode Code:
If $SO[0] = "" then you know a special key was pressed $SO[1] p.e. an "A" on a French, Belgian(, Canadian?) keyboard will return the same KeyCode as a "Q" on almost any other keyboard in the world. /A could be a switch to make Get work in Advanced mode, for downward compatibility I do not know if that makes sense... About MessageBox The Error Code for MessageBox does not give me any added value. Error Code = Return Value Return Value = Error Code It only gave me surprising error values at places in scripts where I did not expect to catch one. |
||||||||
|
|
|||||||
I'm just pulling your leg. As I said I agree that it would make more sense if @ERROR was actually returning an error rather than the result value. The problem is that because it has never worked this way changing the @ERROR value will break existing scripts. Although it has caught you out AFAIK you are the first person, so it is a very rare event. In fact you might be the first person to have ever checked for a (real) error condition following a MessageBox()! I guess the question becomes "Is it better to change the action to something more compliant and break backwards compatibility, or is it better to leave it as-is and accept that you cannot check for an error" I'm fairly neutral on this one, though I'd normally advise against introducing unnecessary compatibility issues. |
||||||||
|
|
|||||||
About MessageBox:
Or wait, maybe this: MESSAGEBOX ("message", "title", style, time-out, 1) A fifth optional parameter to indicate you want real Error Codes? Default = 0? About Get: It is just because you came up with it that I just started thinking about a suggestion with downwards compatibility. |
||||||||
|
|
|||||||
BTW, Thanks for pulling my leg, I liked it. |
||||||||
|
|
|||||||
Quote: "Will" sounds so certain. I would prefer to say "might" since I doubt may people actually work with the @Error returned by MessageBox(). THis is not the first known case of being caught off guard by the @Error returned by MessageBox(). It has been discussed several times and I often use it in examples of overly optimistic coding where @Error is assumed. In fact, my examples include a short UDF that uses EXIT to clear @Error. |
||||||||
|
|
|||||||
hmm... what is wrong with get? and isn't there a @result macro? |
||||||||
|
|
|||||||
Quote: I actually had "could" at first but "could" or "might" implies a very small chance that any script will break. However given the amount of scripts that are out there it is actually very likely that a change is going to break a number. It's also very likely that it will be a very small number. |
||||||||
|
|
|||||||
Jooel, Get works as described in the manual. Richard just referred to the fact that Get handles p.e. function keys with error codes. That is why I just suggested that these *return* values could be put in the Return Value. I did not say it is a must. I do not get the suggestion about the @RESULT macro Code:
When pressing F1 I get Code:
|
||||||||
|
|
|||||||
the suggestion was that instead of using incorrectly the error macro, result macro should be used for the function keys. that is, ruud should change the manual and kixtart to use it. for backwards compatibility setting the error could be left there. |
||||||||
|
|
|||||||
Jooel, I have been reading through the manual and have been searching this board. I am sorry to tell I do not get your suggestion about @RESULT. Could you give a little script that shows how @RESULT resolves F1? How can I catch and evaluate the Return Value the F1 key will give me with @RESULT? Thanks, |
||||||||
|
|
|||||||
Oh, you edited your reply. Do I have to understand you made a suggestion about how it could be? |
||||||||
|
|
|||||||
What about the suggestion returning an array in advanced mode? Code:
A keystroke can return - Key - KeyCode - Ascii value all in different dimension |
||||||||
|
|
|||||||
returning array would break all current scripts using get. can't even consider that. and yes, my post about result macro was a suggestion... and I did edit it before you posted your reply |
||||||||
|
|
|||||||
An array would only be returned if using /A as optional switch. |
||||||||
|
|
|||||||
k... so, what's different with ascii value and keycode? |
||||||||
|
|
|||||||
I was just thinking about what someone would want to verify
|
||||||||
|
|
|||||||
OOps... NM.. wrong forum. |