Weird prompt with Answer
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Weird prompt with Answer
When I first open my stack and run a script to identify non-existent items:
repeat with x = 1 to number of lines of selll
put word 1 of line x of selll into nmm
put "d" & char 1 of nmm into windy
if exists(cd nmm of wd windy) then
else
answer "Item"&&nmm&& "does not exist in stack"&&windy&". Please delete it from your list of selected items." with "OK"
exit mouseup
end if
end repeat
the "answer" prompt formats properly. However, after I run another script, the answer prompt goes berserk. For example, for the answer line above, if, say, nmm = 11111Q,
and windy = d6, it would return with the prompt "Item 11111Q" and the button would not be "OK" but rather "does not exist in stack d6. Please delete it from your list of selected items."
After it begins to act up like this, all of the other scripts with "answer" commands begin to do the same thing, using only the first word or two as the prompt and the rest as the response button title, and dropping the desired title defined with "with".
By the way, this was with LC 7, but I downloaded LC 8 and it is doing the same thing. Grateful for any ideas...
repeat with x = 1 to number of lines of selll
put word 1 of line x of selll into nmm
put "d" & char 1 of nmm into windy
if exists(cd nmm of wd windy) then
else
answer "Item"&&nmm&& "does not exist in stack"&&windy&". Please delete it from your list of selected items." with "OK"
exit mouseup
end if
end repeat
the "answer" prompt formats properly. However, after I run another script, the answer prompt goes berserk. For example, for the answer line above, if, say, nmm = 11111Q,
and windy = d6, it would return with the prompt "Item 11111Q" and the button would not be "OK" but rather "does not exist in stack d6. Please delete it from your list of selected items."
After it begins to act up like this, all of the other scripts with "answer" commands begin to do the same thing, using only the first word or two as the prompt and the rest as the response button title, and dropping the desired title defined with "with".
By the way, this was with LC 7, but I downloaded LC 8 and it is doing the same thing. Grateful for any ideas...
Re: Weird prompt with Answer
hi ya,
Just a stab in the dark at this, but does exiting the mouseup from a loop contribute to this behaviour? if you do "exit repeat" instead, and then let the mouseup exit by itself, does it still happen?
- mark
Just a stab in the dark at this, but does exiting the mouseup from a loop contribute to this behaviour? if you do "exit repeat" instead, and then let the mouseup exit by itself, does it still happen?
- mark
Re: Weird prompt with Answer
Check for quotes and odd characters in the list. I think nmm could contain a double quote, which closes the answer statement prompt in the wrong place.
Re: Weird prompt with Answer
Hi david_fff,
what SparkOut said!
Little sidenote, your ELSE does not make any sense, so just avoid it!
Best
Klaus
what SparkOut said!
Little sidenote, your ELSE does not make any sense, so just avoid it!
Code: Select all
...
if NOT exists(cd nmm of wd windy) then
answer ...
exit mouseup
end if
...
Best
Klaus
Re: Weird prompt with Answer
Thank you all so much. I traced the problem to what must have been an invisible quote in my variable. When I erased the source of that variable and retyped it, it worked as it should. Thanks again!
Re: Weird prompt with Answer
I played around with this some more and now I really do believe in tech gremlins: the source of that variable was the last line in a field, let's say it looked like it was
12345Q
so I use the message box to get the number of chars of this line and it returns - get this - 7! 7!! So I ask for the chartonum of the last char of that line and it returns 0! 0!!! So I click that last line to edit and the cursor is flat up against the Q, and hit delete, and: NOTHING HAPPENS! At least nothing that I can see happens. But now there are 6 chars, not 7, on this line. Then I hit delete once more and the Q erases, retype the Q and all works as it should. SO the moral of this story is: BEWARE OF INVISIBLE CHARACTERS! ...and tech gremlins.
12345Q
so I use the message box to get the number of chars of this line and it returns - get this - 7! 7!! So I ask for the chartonum of the last char of that line and it returns 0! 0!!! So I click that last line to edit and the cursor is flat up against the Q, and hit delete, and: NOTHING HAPPENS! At least nothing that I can see happens. But now there are 6 chars, not 7, on this line. Then I hit delete once more and the Q erases, retype the Q and all works as it should. SO the moral of this story is: BEWARE OF INVISIBLE CHARACTERS! ...and tech gremlins.
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Weird prompt with Answer
The invisible character was a null, whose ASCII number is zero. Counting the number of characters in a line will also count the invisible one, so you get 7. Deleting an invisible character won't move the cursor because the character isn't visible but it still removes it, reducing the count to six.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com