9 Replies Latest reply on Dec 27, 2013 5:30 PM by keywords

    Does "Adjust Window [Hide] / [Restore]" work? (in a script)

    tguise

      Thanks in Advance for any and all input, as I appreciate it.

       

      In FM Pro 12 Adv, I have been tinkering with a set of 3 windows and trying to Hide them and Restore them. While the functionality works well from the built in menu system, I am unable to get the same to work from within a Script.

       

      In researching it seems this was an issue back in Rls 10, but I have not seen anything since then to say one way or the other.

       

      I did see a statement that the feature works in FM 13 Pro Adv.

       

      So, with that being said, does anyone know if Adjust Window [Hide] / [Restore] works properly from within a Script in FM Pro 12 Adv?

       

      Again, "Thanks" in Advance!

      -Tom

        • 1. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
          Mike_Mitchell

          It works fine for me.

           

          Perhaps more detail with exactly what you're doing might provide insight. Maybe a sample file. OS? Device?

           

          Mike

          • 2. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
            TimGriffith

            The script step...

             

            Adjust Window [ decision ]  ...(decision = Resize to Fit, Maximize, Minimize, Restore, Hide )

             

            Have never had an issue with this on both platforms...

            • 3. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
              tguise

              Thanks for responding Mike!

               

              I am working on a PC running MS Win 7 and FM Pro 12 Adv.

               

              The environment is as simple as I can make it.

              It consist of;

              1 File (Test_Window), 2 Tables (Tbl_1 / Tbl_2), each Table having 3 fields each, (ie, f1, f2, f3 / f4, f5, f6)

              The file name is Test_Windows, thus the first window opens with the name of Test_Widow, I then select a New Window from the menu and the second window comes as Test_Window - 2.

              With 2 windows open each containing a layout for each table, I opened a new script naming it Test_Hide_Restore;

               

              *Go to Layout ["Test_Window - 2"]  // I verified it by using Get(WindowName)

              *Adjust Window [Hide]

              *Pause/Resume Script [Indefinitely]

              *Adjust Window [Restore]

               

              That's it, nothing else. When the script runs both windows simply sit there waiting at the Pause.

               

              However, with both windows open when I select from the Menu -> Windows -> Hide Window the top window disappears. I can then recall it from the same menu using Windows -> Show Window.

               

              Again, "Thanks for your time".

              -Tom

               

              Perhaps I am not understanding the functionality of the script command.

              • 4. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
                tguise

                Thanks for responding Tim!

                Please see my detailed response to Mike.

                 

                I am clueless...lol... Just don't know what to say...

                 

                Thanks again,

                -Tom

                • 5. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
                  LyndsayHowarth

                  Your script can't know which window to restore. You might be best to put your window name into a variable which is used in the restore.

                  You should also name your windows...

                   

                  Lyndsay

                   

                  Sent from my iPad

                  Lyndsay Howarth

                  11th Hour Group Pty Ltd

                  1 of 1 people found this helpful
                  • 6. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
                    keywords

                    The first line of your script is wrong: *Go to Layout ["Test_Window - 2"]  // I verified it by using Get(WindowName)

                     

                    "Test_Window – 2" is the window name, not a layout name. You need to use Select Window instead. Also, in your script, because the script has not led to a change of window context the Pause step causes the window, having just been hidden, to be immediately reactivated thus appearing as if nothing has happened. (When you do this manually FM switches focus to whichever other window happens to be next in its stack, but when scripting you have to tellit to switch to a new window, otherwise it keeps the existing window in focus, even if it is hidden—at least, I think that is what is going on!)

                     

                    The following script fixes both these issues and will achieve what you are trying:

                     

                    Select Window [ Name: "Test_Window – 2"; Current file ]

                    Pause/Resume Script [ Indefinitely ]

                    Adjust Window [ Hide ]

                    Select Window [ Name: "Test_Window"; Current file ]

                    Pause/Resume Script [ Indefinitely ]

                    Adjust Window [ Restore ]

                    • 7. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
                      tguise

                      Well keywords, you are the "key!"

                       

                      Good catch on the typing error... I don't know where that came from...

                       

                      BUT, more importantly, you are absolutely correct. Interesting how the Pause step forces the window to remain active.

                       

                      Once that came out of the script and I used the "Select Window" in conjunction with the Adjust Window [action] everything functioned as advertised.

                       

                      Btw- I used the function Get (WindowName) within the Select Window [] and it worked as well.

                       

                      Thanks again keywords!

                      Thanks to all as well!

                      -Tom

                      • 8. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
                        tguise

                        Thanks Lyndsay!

                        Excellent idea on naming the windows.

                        -Tom

                        • 9. Re: Does "Adjust Window [Hide] / [Restore]" work? (in a script)
                          keywords

                          You are welcome Tom. Just one additional point. You say: Btw- I used the function Get (WindowName) within the Select Window [] and it worked as well.

                           

                           

                          That function will work on the first step as long as you activate the script from within the window you wish to hide, because Get ( WindowName ) will return the currently active window.