September 16, 201114 yr Probably a basic question but I'm stumped. In my script there is a initial 'Run Script' or 'Exit' in my first Dialog .... but subsequent internal scripts have a 3 choices Dialog and choosing the second always ends up exiting the full script. How can I reset Get(LastMessageChoice) or clear it?
September 16, 201114 yr Author Example Script: Show Custom Dialog ["New Record" ; "Create a new record"] // choices are Yes or No If [Get(LastMessageChoice = 1)] Perform Script ["New Record"] Else If [Get(LastMessageChoice = 2)] Exit Script End If Script "New Record" Do some stuff... Show Custom Dialog ["Print Label" ; "Print Single, Sheet or None"] // choices are obviously Single, Sheet and None If [Get(LastMessageChoice = 1)] Perform Script ["Print Single"] Else If [Get(LastMessageChoice = 2)] Perform Script ["Print Sheet"] Else Exit Script End If If I choose to "print sheet" it will preform the script but then reverts to the previous scripts Exit Script
September 16, 201114 yr Only the first true 'If' or 'Else If' statement will be executed and all following 'Else If' will be skipped even if their statement is true. (Naturally only until the matching 'End If') So you will not inwoke the Else If [Get ( LastMessageChoice ) = 2] in your first script even if you seleceted button 2 in your second script. Your example should work as you want, but i guess that this is not a copy of the real thing ( mainly due to the syntax error in the Get ( LastMessageChoice = 1 ) ! So what you should do, if you call other scripts before being through with handling Dialog options is to store the Get ( LastMessageChoice ) in a variable, and then test on that instead.
September 16, 201114 yr If I choose to "print sheet" it will preform the script but then reverts to the previous scripts Exit Script I have no clue what you mean by that.
September 16, 201114 yr Kilyaaans remark seams to have sence. You are running a few scripts with a few If/Else statements so logicaly the script will stop on the last ststement that is confirmed true. Once when you pick your "LastMessageChoice" it will execute it and exit. Setting the variable to reuse is an option, you could also set the script to repeat the whole thing after the second MessageChoice option instead of exit the script.
September 16, 201114 yr Author I have no clue what you mean by that. If I select Dialog Button #2 in the script example "New Record" it would cause the previous script to "Exit" once script "New Record" finishes and reverts back to it. If you still don't understand thanks anyway. Others seem to get the basic idea/question.... Kilyaaan HHHhhhuuummmm .... I'm not familiar with how to store the Get ( LastMessageChoice ) in a variable, Can you give me an example or link on the subject? I'll Google it also And yes it was a typo (should be Get ( LastMessageChoice ) = 1 )and yes it's not the actual scripting. I was trying to throw up a quick example so maybe Comment would understand what I was talking about. The original is to complex for me to spend time trying to type it all out........ milanm In one problem script I have a loop in the first script that Loop Show Custom Dialog [] // 3 possible choices If [Get(LastMessageChoice )=1] Perform Script [] Else If [Get(LastMessageChoice)=2] Perform Script [] End If Exit Loop If [Get(LastMessageChoice)=3] End Loop There's prob. a typo in here but you should know basically what I mean.... I think. So once into the script from Get(LastMessageChoice = 2) from this loop if THAT script has a dialog button 3 that is chosen then once back to this loop it will exit the loop.
September 16, 201114 yr Ohh - you should learn - very helpfull. Instead of using the 'Set Field' scriptstep, you use the 'Set Variable'. It will give you a window where you can give your variable a Name and a Value. The name is automatically added a '$' sign in the beginning indicating that this a a variable. like '$choice' The Value is a calculation as you know it from the 'Set Field' scriptstep. In your case it would be: 'Get ( LastMessageChoice )' Giving you a scriptstep like Set Variable [ $choice; Value:Get ( LastMessageChoice ) ] Then you would use the variable in all the following 'If' tests like If [ $choice = 1 ] Variables ( *beginning with one $ sign ) are only accesible in the script they are created. So you can use the same variable name in several scripts that call each other, and each script will work with its own copy of its content. But Yes you should read up on how variables work.
September 16, 201114 yr Ahh yes now you have a problem, unless its intended offcourse Loop Show Custom Dialog [] // 3 possible choices If [Get(LastMessageChoice )=1] Perform Script [] Else If [Get(LastMessageChoice)=2] Perform Script [] End If Exit Loop If [Get(LastMessageChoice)=3] End Loop If the the scripts called in case of 1 or 2 - also uses a dialog ( as at least one of them apparently do ), the last test of Get ( LastMesageChoice ) = 3 will be made with the choice made in the called script, and not from the choice in this script. Because it commes after the End If statement. You must include the third option like. Loop Show Custom Dialog [] // 3 possible choices If [Get(LastMessageChoice )=1] Perform Script [] Else If [Get(LastMessageChoice)=2] Perform Script [] Else // only option 3 left Exit Loop If 1 // always exits End If End Loop hmm - how do you make the nice script example boxes? - can see my copy has lost the box an indentations, and is now just a bunch of colored text, not nealy as readable.
September 16, 201114 yr If I select Dialog Button #2 in the script example "New Record" it would cause the previous script to "Exit" once script "New Record" finishes and reverts back to it. In your original example, the previous script is no longer running when you make your selection in the "New Record" script - so the idea that anything in the subsequent script causes it to exit is rather preposterous. Your latest example is more telling: Loop Show Custom Dialog [] // 3 possible choices If [Get(LastMessageChoice )=1] Perform Script [] Else If [Get(LastMessageChoice)=2] Perform Script [] End If Exit Loop If [Get(LastMessageChoice)=3] End Loop If you follow the timeline of the script, you will see that after performing one of the sub-scripts, you are returned to: and Get (LastMessageChoice) return the last message choice - that is the one made during the sub-script. IOW, there is only one register for the last message choice. Every time you make a choice, that choice replaces the value stored in that register. In your example, the solution is very simple, for example: Loop Show Custom Dialog [ Buttons: “A”, “B”, “Cancel” ] Exit Loop If [ Get (LastMessageChoice) = 3 ] If [ Get (LastMessageChoice) = 1 ] Perform Script [ “A” ] Else If [ Get (LastMessageChoice) = 2 ] Perform Script [ “B” ] End If End Loop If you still don't understand thanks anyway. Others seem to get the basic idea/question.... I was trying to throw up a quick example so maybe Comment would understand what I was talking about. I do not appreciate your snide remarks. Exit Loop If [Get(LastMessageChoice)=3]
September 16, 201114 yr Author Comment... honestly neither of those quotes was meant to be snide. You have helped me on MANY an occasion and I truly thank you for that! But since you brought it up to be honest of late anything that I seem to ask gets an "I don't understand" or as above "Huh?" type of response. To me those seem a bit snide.... Granted you were correct above in not understanding and I should have given a complete example. However a "Could you give an example so we can understand what you mean" would have been a lot nicer...... Regardless ... my apologies. Kilyaaan After you type it in highlight the desired section and use the <> (Code) that in under the smiley face above the text box......
September 16, 201114 yr Author Thanks everyone.......... SSSooooo the answer to the question I asked: Clearing Get(LastMessageChoice) ... is it possible? ... is no. IOW, there is only one register for the last message choice. Every time you make a choice, that choice replaces the value stored in that register. I was afraid all the extraneous examples would take away from the fact that I didn't necessarily want to know how to fix my scripting problems... just if clearing out LastMessageChoice (from the register) was possible. Also I don't think the solution is so simple as that's basically what I already have... Unless moving the "Exit Loop If" statement from after scripts "A" & "B" to before them in the loop affects things?? We are forgetting that Script "A" also has a Custom Dialog with 3 choices... none of which would merit exiting the loop but only exiting Script "A". Script "New Record" or "A" Do some stuff... Show Custom Dialog ["Print Label" ; "Print Single, Sheet or None"] // choices are obviously Single, Sheet and None If [Get(LastMessageChoice) = 1] Perform Script ["Print Single"] Else If [Get(LastMessageChoice) = 2] Perform Script ["Print Sheet"] Else Exit Script End If My temp. solution, aside from writing better scripts, is to change the above section Else > Exit Script for button 3 to incorporate another custom dialog right after that with only 2 buttons. Something like "Are you sure you don't need any labels?" Yes or No... Anyway I had another question about my new database/tables structure but I'll figure it out on my own. Have a great weekend everyone ... and I do mean EVERYONE! BTW - I do know/understand variables for the most part but hadn't considered using them with Custom Dialogs and If statements.... Thanks.
September 16, 201114 yr I don't think I have responded with a "Huh" more than a handful of times. It's an expression of frustration, when the question is so unclear that asking for a clarification seems futile. The fact that you are a long-time member here and should have known better is another factor contributing to the frustration. I thought I'd mention this, because your latest version of the question has reverted back to the original - and again makes no sense, IMHO. just if clearing out LastMessageChoice (from the register) was possible. What exactly would "clearing" mean, in practical terms? That the next time you ask for Get(LastMessageChoice) you will get an empty value? What would be the point of that? Unless moving the "Exit Loop If" statement from after scripts "A" & "B" to before them in the loop affects things?? Yes, of course it does "affect things" - haven't you tried it?
September 16, 201114 yr Author What exactly would "clearing" mean, in practical terms? That the next time you ask for Get(LastMessageChoice) you will get an empty value? What would be the point of that? It would seem that the question was clear since you're able to figure out that it would return an empty value.... you just don't know why someone would want to do it. So therefore it doesn't makes no sense? Yes, of course it does "affect things" - haven't you tried it? Apparently not... so I'll have to. I have ALMOST always just put my Exit Loop right before the End Loop. I didn't/don't see where in this instance it can change things if the last script (say script "A") put a "3" into Get(LastMessageChoice) from it's custom dialog. But if you say so I'll try it...... BTW - Longtime member only means .. well just that. Some of us haven't had programming classes or any formal training. We're just trying to feed the family and we use Filemaker software. No need to make us feel like idiots for it......
September 16, 201114 yr It would seem that the question was clear since you're able to figure out that it would return an empty value.... you just don't know why someone would want to do it. So therefore it doesn't makes no sense? Yes, that is precisely why it doesn't make sense (to me). Presumably, you would know that the variable has been cleared, would you not? Then what's the point in asking for something that you know will return empty? In any case, it is NOT possible to "clear" Get(LastMessageChoice) - and I don't think it would solve your problem if it were. I have ALMOST always just put my Exit Loop right before the End Loop. It's actually good practice to put Exit Loop If [] as early in the loop as possible. No need to make us feel like idiots for it...... Huh?
September 17, 201114 yr You can't clear Get ( LastMessageChoice). But you can create a variable and clear that. Like this: Show Custom Dialog ["Print Label" ; "Print Single, Sheet or None"] // choices are obviously Single, Sheet and None Set Variable [$choice ; Get ( LastMessageChoice) ] If [$choice = 1] Perform Script ["Print Single"] Else If [$choice = 2] Perform Script ["Print Sheet"] Else Exit Script End If Set Variable [ $choice ; "" ]
Create an account or sign in to comment