Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6724 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

I've never used the Get(LastMessageChoice) and so far I'm running into difficulties. The problem I think is in syntax. I create a script with the ShowCustom message dialogue... have 2 choices... got that much, now when I go to the next step in the script.. the If part and type in the the Get(LastMessageChoice) it either gives me a field not found or an operator missing. Just to cover all bases, I place this text by dropping and dragging over the If from the scripts menu and just start off with the Get... right? This is really frustrating and probably easier than I think. Thanks for your help.

V

Posted

The Get(LastMessageChoice) returns a number corresponding to the button last clicked. The default (right hand most) returns 1 the other(s) return 2 or 3 (working right to left).

I suspect you are trying to encode the If statement inside the calculation box? whereas you should use the explicit SCRIPT STEP:

"If"

to commence the conditional test, then specify the Get(LastMessageChoice) function with the calculation dialog.

IF :) you are still stuck then post a screen shot of the calculation box, and possibly your script.

Posted (edited)

I have not used this function in the past. So I'm not sure if it's me, or the brevity of my script in the sample file, but I found I had to add a "Go to Field" step, and then "Commit Records/Requests" step in order to see the field update. Other wise, I had to click in the field and out again to see field to update. Please correct me if this isn't necessary.

Show Custom Dialog [ Title: "LastMessageTest"; Message: "Select a button"; Buttons: “Button 1”, “Button 2”, “Button 3” ]

Go to Field [ GetLastMessage::getMessage ]

Commit Records/Requests [ Skip data entry validation; No dialog ]

See the sample rough sample file attached.

HTH

Lee

GetLastMessage.fp7.zip

Edited by Guest
cleaned it up a little
Posted

I think I know what's bothersome!!

Button 1, the rightmost, is the default. It's also the only button that, when clicked, causes the data from any input fields to be written back to the corresponding Filemaker fields.

I would if the cirumstances allowed it instead embed following Applescript:

display dialog "Gimme answers" default answer "" buttons {1, 2, 3}

...because it wipes out any defaultish behaviour! ...obviously followed by the scriptsteps required to fill in the entered data in the dialogbox into the awaiting fields!

--sd

Posted

The get(lastmessagechoice) is really quite straightforward. As Idealdata said you have a max of 3 possible returns. From right to left they are 1 , 2 or 3.

The script could be along the following lines ( assume a custom dialogue box with right hand answer button being 'OK' a middle button saying 'not sure' and the third being cancel)

Show custom dialogue 'Are you sure you want to delete this record'

If(GetLastMessageChoice) = 1

Delete record

endif

If(GetLastMessageChoice) = 2

perform script 'not sure'

endif

If(GetLastMessageChoice) = 3

exit script

endif

I realise that is a very dumbed down script but there really isn't any more to it than that.

Phil

Posted (edited)

I liked the way Phil provided sample script which shows how to use it within an If[] test (as Mark explained). I was about ready to respond with the same sort of example. Lee, your file was great but it didn't show it in script for someone new - it showed the results. We take many things for granted whereas it appeared that understanding the script logic (by example) would be helpful as well. It nicely summed up everyone's input. :wink2:

I should add that a test of all three values wouldn't be necessary because if either of the first one or two criteria isn't met, script will terminate anyway. In other words, test for 1, do something; test for 2, do something else. Any other result would exit script.

Edited by Guest
Posted

I think I'd prefer a shorter version:

Show Custom Dialog [ Buttons: "OK", "Cancel", "Third" ]

If [ Get ( LastMessageChoice ) = 1 ]

# do first choice

Else If [ Get ( LastMessageChoice ) = 2 ]

# do second choice

Else

# do third choice

End If

Posted

Sorry, my post to Phil didn't come out the way I meant it. I had edited it, and I must have deleted some of it. So, please accept my apology if I offend anyone.

I was really trying to see what the difference was, and until I saw comments version, it just wasn't getting through.

:bang: This was a case of not being able to see the forest through the trees.

I don't know why I thought that this was a new function in Advance (maybe because I'm have so much fun find all of the new goodies). :) When reading the Online Help, I still didn't connect it to the old Status( CurrentMessageChoice ).

Thank goodness others jumped in with the correct information.

Thanks,

Lee

This topic is 6724 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.