7 Replies Latest reply on Dec 29, 2012 10:12 AM by Snozzle's

    On Start Up

    Snozzle's

      Title

      On Start Up

      Post

            

           Hi,

            

           I have a problem that's been annoying me for some time now.

            

           Basically, I have an "On StartUp" script that I trigger when the user opens the datafile ... "OnFirstWindowOpen" I wish I could run my script before "OnFirstWindowOpen" but I can't.  And the "On Start Up" script puts the user on a specific layout / size THAT I NEED to have priority.

            

           The only problem, Filemaker for some reason, opens with my largest layout size for a split second.  Long enough to make the database look unprofessional, instead of looking to the script and holding the layout view until it's called ... Why can't I have that ???

            

           Now I've pushed the layout to the Top of the Layout Manage window, I've opt in on the Layout in the On Start Up File Option in Filemaker where it says "Switch to layout" ...

            

           I don't want to switch to anything, I want my "ON START UP" script to be in control when the datafile opens / starts and the layout I specify length and width FIRST, not what FILEMAKER defaults to if I'm going to guess that is what is happen, then the On Start Up script runs on "OnFirstWindowOpen".  Filemaker is ignoring my last layout which I force my use to to exit the application and it is the layout I need my user to be on first when openning the file.

            

           I force my user to navigate to the Navigational layout where I have a button "Quit" to quit the application.  But when I reopen the file, the Navigational Layout size is ignored. and my largest layout size is displayed.  This driving me insane.  Any help here. 

            

           What is happening ??? I sure would like to know.  

            

           I want my NAVIGATIONAL layout to take precedence NO MATTER WHAT FILEMAKER WANTS TO DO.  So how do I do that ??

        • 1. Re: On Start Up
          philmodjunk

               Filemaker is ignoring my last layout which I force my use to to exit the application and it is the layout I need my user to be on first when openning the file.

               So the last layout selected when the file is closed is also the first layout that they should see?

               Did you select this layout as the "switch to layout" in file options? Did that work?

               Is this file hosted from another computer? If so, open the file from the host computer (If hosted by FileMaker Por) or take the file down off the server and open directly with FileMaker Pro (If hosted by Filemaker Server) and make sure that this layout is the last layout selected when you close the file. Then return the file to the server and access from a client machine to see if it makes a difference.

               It may also be that you are on the desired layout when the file opens, but your start up script has to change layouts in order to do what it is set up to do. If so, make Freeze Window the first script step of your start up script and then make sure that your start up script returns to the correct window before it exits.

          • 2. Re: On Start Up
            Snozzle's

                 I double checked, my Freeze Window and Refresh is right where it suppose to be.

                 What causes the Freeze Window to cancle if within a script it is in the script step??  Would another script call within the On Start Up script cancel the Freeze Window.

                 The Freeze Window also desn't work with I want to tab to my 9th tab.  The layout with the TAB Panel defaults to the tab in the tab default selection for the TAB Panel, regardless of the Freeze Window, then my script step to goto the tab 9 happens.

                 This is really annoy.

                 Sometime when I quit filemaker with the pull down menu directly, on re-opening the file, Filemaker respects the last layout out.  Sometimes.

                 Most of the time, my largest layout ( size ) the layout is correct, pops first for just a second, then my OnFirstWindowOpen" script triggers and the window is resized.

                 When I run the script thru the script debugger, it doesn't do it, it honors every script step.

                 Whats is happening.  If I could understand it, maybe I can be a piece with it!

                 Thank you so much for you insight, I am grateful.

                  

                  

            • 3. Re: On Start Up
              philmodjunk

                   You may need to post your script.

                   One script calling another will not cause the screen to update.

                   Opening a new window will.

                   A second freeze window ( I think ) will.

                   A scripted pause will update the window.

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
              • 4. Re: On Start Up
                Snozzle's

                     Hi,

                     I tried and fored the script to exit and placed an EXIT script step right after the third script step which resized the window and then goes to the layout.

                     And it still does it.  Really wierd.

                     I'll post the script.

                     Thank you.

                • 5. Re: On Start Up
                  Snozzle's

                        

                  Thank you, here is the script ...

                        

                  On Start Up

                  This "On START UP" script runs with the "OnFirstWindowOpen" triggers.  Which to me is wrong.  I need this script to run BEFORE "OnFirstWindowOpen".

                  Set Error Capture [ On ]
                  // Perform Script [ “Center Window 700 x 900” ]
                  Freeze Window
                       Perform Script
                  [ “Center Window 689 x 1078 Client Logo” ] Go to Layout [ “Navigation” (Navigation) ]
                  If [ Get ( AccountPrivilegeSetName ) = "[Full Access]" ]

                  Show/Hide Toolbars

                       [ Hide ]

                  Else
                       Show/Hide Toolbars

                       [ Lock; Hide ]

                  End If

                  I PLACED AN EXIT SCRIPT STEP HERE just to see what would happen, and Filemaker Still rezided my window to my largest size.  It pops for just a half a second, long enough to see it!

                  Go to Layout [ “Globals” (Globals) ] If[Get(FoundCount) ≤0]

                  New Record/Request
                       Else If
                  [ Get ( FoundCount ) > 1 ]

                  Delete All Records

                       [ No dialog ]

                  New Record/Request End If

                  Commit Records/Requests

                       [ No dialog ]
                  Go to Layout [ “Preferences” (Preferences) ] If[Get(FoundCount) ≤0]

                  New Record/Request

                  Set Field [ Preferences::Pref Rate Manual Ck Bx; 1 ]

                  Set Field [ Preferences::Pref Rate XML Ck Bx; "" ]

                  // Commit Records/Requests [ No dialog ]

                  Else If [ Get ( FoundCount ) > 1 ] Show All Records

                  Go to Record/Request/Page

                       [ First ]

                  // Sort Records [ Keep records in sorted order; Specified Sort Order: Preferences::Pref DateTime Stamp; ascending ] [ Restore; No dialog ]

                  Omit Multiple Records [ 1 ] [ No dialog ]

                  Delete All Records

                       [ No dialog ]

                  End If
                       If
                  [ IsEmpty ( Preferences::Pref Invoice Sequence ) ]

                  Set Field [ Preferences::Pref Invoice Sequence; 1001 ] End If

                  #Do not move this next IF - You must be on the Preference Layout to import the XML Data!

                  If [ Preferences::Pref Rate XML Ck Bx = 1 and Preferences::Pref Rate Manual Ck Bx ≠ 1 ] Set Variable [ $Set Temp Path; Value:Choose ( Abs ( Get ( SystemPlatform ) ) -1 ;

                       /*MAC OS X*/

                       "filemac:" & Get ( TemporaryPath ) & Preferences::Pref XML Style Sheet ;

                       /*WINDOWS*/

                       "filewin:"& Get ( TemporaryPath ) & Preferences::Pref XML Style Sheet )]

                  Export Field Contents [ Preferences::Pref XML Style Sheet; “$Set Temp Path” ]
                  Import Records [ XML (from http): http://www.RealDropShippers.com/Forex/USD.xml; XSL (from file): $Set Temp Path ]

                       [ No dialog ]
                  Set Variable [ $Set Date; Value:Preferences::Pref XML Date ]
                  Set Field [ Preferences::Pref XML Date; Right ( $Set Date ; 5 ) & "-" & Left ( $Set Date ; 4 ) ]

                  End If
                       Set Field
                  [ Preferences::Pref Search Invalid Text; "" ]
                  If [ IsEmpty ( Preferences::Pref Begin Month ) or IsEmpty ( Preferences::Pref Begin Yr ) ]

                  Loop

                  Show Custom Dialog [ Title: "Message"; Message: If ( IsEmpty ( Preferences::Pref Search Invalid Text ) ; "Please enter Month / Year business calendar begins." ; Preferences::Pref Search Invalid Text ); Default Button: “OK”, Commit: “Yes”; Input #1: Preferences::Pref Begin Month, "Month example; 01, 1, 10"; Input #2: Preferences::Pref Begin Yr, "Year example; 2012" ]

                  Set Field [ Preferences::Pref Begin Month; Trim ( Preferences::Pref Begin Month ) ]

                  Set Field [ Preferences::Pref Begin Yr; Trim ( Preferences::Pref Begin Yr ) ]

                  Exit Loop If [ ( Length ( Trim ( Preferences::Pref Begin Month ) ) > 0 and Length ( Trim ( Preferences::Pref Begin Month ) ) ≤ 2 ) and Length ( Trim ( Preferences::Pref Begin Yr ) ) = 4 ]

                  Set Field [ Preferences::Pref Search Invalid Text; "Invalid. Month must be no more than digits, and year must be four digit.¶¶ Please try again." ]

                  End Loop End If

                  Set Field [ Preferences::Pref Search Invalid Text; "" ]
                  If [ Month ( Get ( CurrentDate ) ≥ Preferences::Pref Begin Month and Year ( Get ( CurrentDate ) ) ≠ Preferences::Pref Begin Yr ) ]

                  Set Field [ Preferences::Pref Begin Yr; Year ( Get ( CurrentDate ) ) ] End If

                  Commit Records/Requests

                       [ No dialog ]
                  Go to Layout [ “Images” (Images) ] If[Get(FoundCount) ≤0]

                  New Record/Request
                       Else If
                  [ Get ( FoundCount ) > 1 ]

                  Show All Records
                       Go to Record/Request/Page

                       [ First ]
                  Sort Records [ Keep records in sorted order; Specified Sort Order: Images::DataTime Stamp; ascending ]

                       [ Restore; No dialog ]

                  Omit Multiple Records [ 1 ] [ No dialog ]

                  Delete All Records

                       [ No dialog ]

                  End If
                       Commit Records/Requests

                       [ No dialog ]
                  Go to Layout [ “Navigation” (Navigation) ] If[Get(FoundCount) ≤0]

                  New Record/Request
                       Else If
                  [ Get ( FoundCount ) > 1 ]

                  Show All Records
                       Go to Record/Request/Page

                       [ First ]
                  Sort Records [ Keep records in sorted order; Specified Sort Order: Navigation::DateTime Stamp; ascending ]

                       [ Restore; No dialog ]

                  Omit Multiple Records [ 1 ] [ No dialog ]

                  Delete All Records

                       [ No dialog ]

                  End If
                       Set Field
                  [ Navigation::Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref

                       Begin Yr ) ]

                  Set Field [ Navigation::Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Navigation::Search 1; 1 ]
                  Set Field [ Sellers::Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref

                       Begin Yr ) ]

                  Set Field [ Sellers::Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Sellers::Search One; 1 ]

                  Set Field [ Sellers::Seller Search Month No; Month ( Get ( CurrentDate ) ) ]

                  Set Field [ Sellers::Search Region UAE; "UAE" ]

                  #Not relevant anymore. The next Set Field is a field used in the relationship chart for Seller to separate between UAE and NonUAE. Use any text other than UAE.

                       December 28, 2012 17:07:51 WLDataBase.fmp12 - On Start Up -2-

                  #Not relevant anymore. The next Set Field is a field used in the relationship chart for Seller to separate between UAE and NonUAE. Use any text other than UAE.

                  Set Field [ Sellers::Search Region NonUAE; "KSA" ]

                  Set Field [ Sellers::Search Zero; "0" ]

                  Set Field [ Facilitator::Facilitator Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr ) ]

                  Set Field [ Facilitator::Facilitator Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Facilitator::Facilitator Search Month No; Month ( Get ( CurrentDate ) ) ]

                  Set Field [ Facilitator::Search Facilitator One; 1 ]

                  Set Field [ Facilitator::Search Zero; "0" ]

                  Set Field [ Forecast::Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr ) ]

                  Set Field [ Forecast::Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Forecast::Search One; 1 ]
                  Set Field [ Forecast Line Items::Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref

                       One::Pref Begin Yr ) ]

                  Set Field [ Forecast Line Items::Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Forecast Line Items::Search One; 1 ]
                  Set Field [ Clients::Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref

                       Begin Yr ) ]

                  Set Field [ Clients::Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Clients::Search Client Month No; Month ( Get ( CurrentDate ) ) ]

                  Set Field [ Clients::Search Client Zero; "0" ]

                  Set Field [ Clients::Search Client One; 1 ]

                  Set Field [ Regions::Region Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr ) ]

                  Set Field [ Regions::Region Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  Set Field [ Regions::Region Search Month Number; Month ( Get ( CurrentDate ) ) ] Set Field [ Regions::Region Search One; 1 ]
                  Set Field [ Projects::Project Search UAE; "UAE" ]
                  Set Field [ Projects::Project Search C; "C" ]

                  Set Field [ Projects::Project Search D; "D" ]
                  Set Field [ Projects::Project Search O; "O" ]
                  Set Field [ Projects::Search Date; Get ( CurrentDate ) ]

                  // Show Custom Dialog [ Title: "Message"; Message: Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr ) & "¶¶" & Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One:: Pref Begin Yr +1 ) - 1; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

                  Set Field [ Projects::Search Date 1; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr ) ]

                  Set Field [ Projects::Search Date 2; Date ( Navigation One to Pref One::Pref Begin Month ; 1 ; Navigation One to Pref One::Pref Begin Yr +1 ) - 1 ]

                  // Show Custom Dialog [ Title: "Message"; Message: Projects::Search Date 1 & "¶¶" & Projects::Search Date 2; Default Button: “OK”, Commit: “Yes” ]

                  Set Field [ Projects::Search Month No; Month ( Get ( CurrentDate ) ) ] Perform Script [ “Check Preference Fields” ]
                  If [ Get ( AccountPrivilegeSetName ) = "[Full Access]" ]

                  Set Field [ Navigation::Image Lock; Navigation One to Pref One::Pref Image Lock Open ]

                  Set Field [ Navigation::Search Lock 1; 1 ] Else

                  Set Field [ Navigation::Image Lock; Navigation One to Pref One::Pref Image Lock Closed ]

                  Set Field [ Navigation::Search Lock 1; "" ] End If

                  Refresh Window

                       [ Flush cached join results ]

                  Commit Records/Requests

                       [ No dialog ] Exit Script [ ]

                        
                  • 6. Re: On Start Up
                    philmodjunk

                         This isn't what I expected from your original post. Am I correct that the issue is that the size of the first window to open is not the size that you want?

                         Is this database hosted over a network?

                         a few observations on your script that have nothing to do with this issue:

                         When computing a file path to the temporary items folder, you can use this expression:

                         "file:" & Get ( TemporaryPath ) & Preferences::Pref XML Style Sheet

                         and it will be correct for both Mac and Windows systems.

                    Refresh Window [ Flush cached join results ]

                         is a step best avoided. Why do you need it? If you are using the "flush" parameter to get a filetered portal to update, there are other ways to do this that don't risk the significant delays that Refresh Window can trigger.

                          

                    • 7. Re: On Start Up
                      Snozzle's

                           Hi PhilMOdJunk and thank you taking the time to review my issues :-)

                           Sorry for the delay, family emergency.

                           I have many layouts.  my biggest layout was a client request.  it is 1400 pixels wide.  This is the size that Filemker pops up when Filemaker loads the last layout, which is my naviagiaonal layout, the layout I force my clients staff to, to exit / quit the application.  However, my navigaional layout is smaller; 1078 this is the width of the clients logo that they wanted to use on the openning layout, the navigational layout.  But again, on startup, for some reason Filemaker pops the largest width 1400, not 1078 which was the last layout width ??  So it is not the layout I am having trouble with, but the size of my largest width, for a layout that my customer requested, that is not the size when the customer exits.  They exit on the Navigational layout which is sized to 1078, not 1400.  Yet Filemaker pops this size 1400 for just a moment when loading my last layout which was 1078 ??

                           Again, on start up, Filemaker pops the largest width 1400 for just a moment, long enough to see it, then the Navigational layout is re-sized by the "OnFirstWindowOpen".  This to me is strange only becuase before I was able to run my "On Start Up" script without having to assign it to a script trigger.  Odd, before I could pull down the File Option and select the script to run on start up and the layout ???  Anyway, If you notice the red text where I placed an exit script step, I was just curious what would happen.  And to my supprise, the largest window size was still popped even with this script exiting immediately so I'm confused why the 1400 width is being used instead of the 1078 width which is that last layout size when the user quits?

                            

                      Refresh Window [ Flush cached join results ] This comes from a caclulation that would not recalculate when I first started to learn Filemaker and unless I performed this script step, the calculation would not recalculate, it was a desperate step.  The gentlemen who was helping me didn't believe it when I told him what I did until he saw the calculation not update and then after the Refersh Window script step; he sat there and thought about what was hapenning and said OK, yes, this is why, but at the time it was beyond me ( still is ) and since then, when I have trouble with recalculations, I push the Refresh Window into the script, and some times it works, some times it doesn't ?? trying to get my caclulation to recalulate is annoying.  So, I'm still find myself forcing a recalculation by going into find then back to browse quickly in two script steps.  Again, Refresh Window is from a past problem that I never really understood and still worry, so I add it. to be safe. I wish I could under stand it better, and when to use it.  And why I have to script in a goto Find Mode then back to Browse Mode to force a calculation to recalculate, hmm ... Any insight would be grateful here as well :-)

                            

                      Temporay Folder,  thank you for you suggestion.  The temporary folder is confusing to me, and I had one example from a previous request from this forum I believe to push a document from a container field some place else other than the dest top and the example that was given, to place my documents from a contain fields to the temporary folder was exactly what I needed and that is the example you see.  I will review your example and I am grateful for your insight.  Thank you :-)

                            

                           Tom :-)