10 Replies Latest reply on Oct 11, 2016 5:44 AM by beverly

    Mysteries of FM15 Script building


      I finally updated from 13 Advanced to 15 Advanced. And while creating a new file, I started creating my scripts, succeeded with the first few but then somehow hit a wall! I really can't understand the new "help" of the window that opens with my choices as I type a step. I see the step I want, it takes its place in the script steps, but I tap to continue and the window disappears and takes my script step with it!

      The line number can light up, so I thought to tap that to "accept" the line but it doesn't help.


      I can't get past the [Get(LastError)>0] because it disappears. Frustrating.

      And for fun, am I mising some OK or SAVE button when I finish the scripts I work on? I always get a warning that an open script needs saving, but it seems a silly thing if I can't save before closing the window.

        • 1. Re: Mysteries of FM15 Script building

          It does take some getting used to, so here are a few tips...


          when the suggestions open below, you can use your arrow keys on your keyboard to highlight the one you want (also the mouse--double click for some reason--for those that are not keyboard crazy).


          If you need to select a button in the help, you can use the space bar to select this as well.


          you can also specific the script step by completely typing it. Sometimes this is actually faster for me


          To select between settings of a command, tab will toggle the highlight of the settings icon and spacebar will open it


          as for saving a script, the script title on the left shows and in the tab above both display an asterisk after the name (and the title dims) to indicate unsaved changes. Command or Control S (Mac vs. PC) will save the script.

          • 2. Re: Mysteries of FM15 Script building
            David Moyer


            I found the space bar to be handy using the new Script Workspace "Intellisense".

            For me, ctrl-S-W is automatic when done with a script.

            • 3. Re: Mysteries of FM15 Script building


                  When you say 'tap to continue', what are you tapping?


              I think what you need is the Return/Enter key or the Tab key.  When you start typing, it will show you all the script steps that match what you typed.  You have to hit Return in order to 'accept' the match or the highlighted step.  You can use the arrow keys to cycle through the shown steps, then hit Return.


              If there is only one matched step, then it should automatically 'select' it for you.  E.g. if you type "#" for a comment line, you don't have to hit return.  (Hmmm...this didn't happen when I typed out "perform find/replace" though.  I swear that I used to have hit tab/return to select the comment step, too.  Something changed somewhere - maybe it only applies to the Comment step.)


              There are also lots of short cuts for steps, e.g.  "GTRR" = "Go To Related Records".  Someone posted a list of things here in the forums I believe.


              Double clicking an entry in the pop-up window also works.

              1 of 1 people found this helpful
              • 4. Re: Mysteries of FM15 Script building

                "When you say 'tap to continue', what are you tapping?"

                Well I guess that was a little vague! Tapping on the ENTER key to accept a choice. But in fact I now understand more about what what confusing at first.


                Disclaimer: I work on a 27" Retina Mac with 5000px resolution, allowung me to enlarge my screen image to such a size you wouldn't believe it! I have really crappy vision, and to add to the fun, I work in inverted colors to have white text on a black page! Usually. And inverting colors makes some colored text (like links and "highlighted" copy basically disappear. Then comes the pleasure of skating around the screen to see what is not yet in the viewport  So I do have fun.


                I have managed to build a quite nice project with many great scripts to handle tasks on an iPad, where sometimes even selecting a time is annoying (to me), so I make buttons to cheat the system.


                I wanted to jump back in to thank you all for the help. I didn't want to be rude and just wander off.

                FMP is just too much fun for me to quit now.



                • 5. Re: Mysteries of FM15 Script building

                  UPDATE: NEW Script Workspace Problem!

                  I’m am confused by some strange experiences in the Script Workspace. I have had hit-and-miss success trying to paste in code copied from a Support page*, trying to save some time. Usually I get the beeping signal that I failed, but sometimes it works! I think I stumbled onto why it works: I THINK I need to have a related section of the script groups open. That’s a vague possibility, anyway.


                  Well, I want to learn about scripting control of Button Bars. I foumd an example with a Case( construction, copied it and it actually pasted! I was happy, started revising it to fit my needs, had some success. I also had a chance to see the Case step listed in the script steps window in a group called Logic. But when I wanted to start a new script to see if I could repeat my work, it all went wrong!


                  I simply cannot find the Case steps in the script window. No search results. Starting to type Case in the Workspace does not bring a list of options. Nothing seems to locate the Logic group again! Curiously (to me) the IF constructs are in Control, and I think Case is similar to IF steps, but I can’t find Case anywhere.


                  Is this making any sense? It seems unlikely that I removed it somehow, but I have no “next step” to try.


                  – Steve


                  * The code:

                  Case ( ExampleTable::Actions = "Events" ; "Events" ; "Contacts")

                  • 6. Re: Mysteries of FM15 Script building


                       "Case()" is a Function, not a script step.  It can only be used in a 'calculation' editing window. 


                    So to use it in a script you would need to start with a script step that uses a calculation window. For example, 'set variable' or 'set field'.  Then when you open the calculation window for either of those steps, you can use the Case() function.


                    Perhaps confusing the matter is that the IF() command has both a function version and a script step.  The FileMaker Help documents have a list of all the script steps and functions under the Reference section.  Or, as you were noting, the side panel on the Script workspace window will only show you Script steps m, so that is a list of all the available script steps.


                    -- Justin

                    • 7. Re: Mysteries of FM15 Script building
                      David Moyer


                      just to add to Justin's help, a tiny bit - If you need to implement a Case structure in script steps, there's:


                      Else If

                      Else If

                      Else  // default

                      End If

                      • 8. Re: Mysteries of FM15 Script building

                        Further, to clarify possible issues with pasting script steps:  The FileMaker Script Workspace window will not allow you to paste random text strings.  It has to be properly formatted XML content that is of 'script' type.  So you most likely won't ever be able to copy something from a web site and paste it directly into a Script.  (There are some programs that will let you view the contents of the clipboard - using one of these you can see what's there after copying a step from a Script.)


                        As a test, open a script and copy a script step from it (cmd-c, ctrl-C).  Then go to a text editor and try to 'paste' that step.  It doesn't work.  The item on the clipboard from FM is not simple text.  Even though the Script steps in FM LOOK like regular text, they aren't.


                        However, a Calculation from FM IS just regular text.  This allows you to copy and paste in custom functions or other calculations you find from the web.  But it has to be pasted into a Calculation dialog box.


                        --  Justin

                        1 of 1 people found this helpful
                        • 9. Re: Mysteries of FM15 Script building

                          Justin (and David), this was just the exact thing I needed to see! I have clearly been getting along for a long while with really basic FM skills, and see what happens when I ramp it up to a level I'm not yet familiar with? I do understand your explanation and I feel silly. Now I see why it sometimes shows; I was in a calc window! Wow!


                          I appreciate the help. I'm not doing this as a business, just for fun. But I do have fun working to solve problems with FM Pro. This help moves me forward a bit more.



                          • 10. Re: Mysteries of FM15 Script building

                            There are several tutorials available in this forum


                            Quick Start Training

                            and the FileMaker Training series is excellent:

                            FileMaker Training Series | FileMaker

                            some upcoming webinars:

                            Webinars | FileMaker