9 Replies Latest reply on Dec 18, 2015 12:51 AM by user14047

    Script to Detect Devices-iPad Pro

    mikeo'neil

      Hi Folks,

       

      Does anyone have a method that detects the specific Device being used?

       

      I am trying to write a script that will detect the device being used to access a database (FMPA 14 & FMP 14 Go). Not hosted on Server. Devices will be MAC Book Pro, Windows 10 Laptop, iPhone 5, 5S, 6, 6Plus, iPad 2, and iPad Pro. I found a response on the forumn that addressed a method but there was no mention for iPad Pro Screen Width.

       

      If anyone has a better method that I am attempting please advise.

       

      (Partial Script)

      If( Get ( Device ) = 1 or Get ( Device ) = 2

      //Checks for Mac or Windows

        Perform Script [GOTO Detail]

       

      Else If (  Get ( Device ) = 4//iPhone 5 )

        Perform Script [GOTO iPh5 Detail]

       

      Else If (  Get ( Device ) = 4 and Get ( ScreenWidth ) = 375)

      //iPhone 6

        Perform Script [GOTO iPh6 Detail]

       

      Else If ( Get ( Device ) = 4 and Get ( ScreenWidth ) = 414)

      //iPhone 6 Plus

        Perform Script [GOTO iPh6Plus Detail]

       

      Else If (  Get ( Device ) = 3//iPad )

        Perform Script [GOTO iPad Detail]

       

      Else If ( Get(  Device) = 3 and Get(ScreenWidth) = "?????”)

      //iPad Pro

        Perform Script [GOTO iPh6Pro Detail]

      End If

       

      Thanks,

       

      Mike

        • 1. Re: Script to Detect Devices-iPad Pro
          user14047

          Get ( WindowWidth ) result is fixed irrespective of orientation.

           

          If [ Get ( Device ) = 1 or Get ( Device ) = 2 ]

            Perform Script [ “GoTo Desktop” ]

          Else If [ Get ( WindowWidth ) ≥ 1024 ]

            Perform Script [ “GoTo iPad Pro” ]

          Else If [ Get ( WindowWidth ) ≥ 768 ]

            Perform Script [ “GoTo iPad” ]

          Else If [ Get ( WindowWidth ) ≥ 414 ]

            Perform Script [ “GoTo iPhone 6Plus” ]

          Else If [ Get ( WindowWidth ) ≥ 375 ]

            Perform Script [ “GoTo iPhone 6” ]

          Else If [ Get ( WindowWidth ) ≥ 320 ]

            Perform Script [ “GoTo iPhone 5” ]

          End If

           

          FileMaker Knowledge Base : Using Screen Stencils to design iOS friendly layouts

          complement

          DEVICEORIENTATIOnTOOLBARSTATUS BARWIDTHHEIGHT
          iPad ProPortraitOnOn10241258
          iPad ProPortraitOffOn10241302
          iPad ProPortraitOnOff10241302
          iPad ProPortraitOffOff10241346
          iPad ProLandscapeOnOn1366916
          iPad ProLandscapeOffOn1366960
          iPad ProLandscapeOnOff1366960
          iPad ProLandscapeOffOff13661004
          1 of 1 people found this helpful
          • 2. Re: Script to Detect Devices-iPad Pro
            RickWhitelaw

            Wouldn't a Case function work better in this situation?

            • 3. Re: Script to Detect Devices-iPad Pro
              eoin

              Else If [ Get ( WindowWidth ) ≥ 1024 ]

                Perform Script [ “GoTo iPad Pro” ]

              Would this not be incorrect in the case of an iPad in landscape mode which has a width of 1024?.

              Or am I missing something?.

              • 4. Re: Script to Detect Devices-iPad Pro
                mikeo'neil

                Hi eoin,

                 

                I tested the provided script in an "Onopen" Trigger. The only device I couldn't test was the iPad Pro and iPhone 6 Plus. All other iOS devices were tested by opening the database GO file in Portrait and Landscape orientations and functioned as desired.

                 

                Mike

                • 5. Re: Script to Detect Devices-iPad Pro
                  mikeo'neil

                  After seeing your reply I searched on the forum and found some responses to "If vs. Case". I am only using this for 7 possibilities. From what I have read the Case function is much cleaner and may save a few CPU cycles. I don't think it really matters for performance in my use.

                   

                  Thanks for the Input.

                   

                  Mike

                  • 6. Re: Script to Detect Devices-iPad Pro
                    user14047
                    DeviceOrientationScreenHeightScreenWidthWindowContentHeightWindowContentWidthWindowDesktopHeightWindowDesktopWidthWindowHeightWindowWidthMenubarStateStatusAreaState
                    iPhone 5portrait56832046032054832056832011
                    iPhone 5landscape32056825256832056856832011
                    iPhone 6portrait66737555937564737566737511
                    iPhone 6landscape37566730766737566766737511
                    iPhone 6 Plusportrait73641462841471641473641411
                    iPhone 6 Pluslandscape41473634673641473673641411
                    iPadportrait10247689167681004768102476811
                    iPadlandscape768102466010247481024102476811
                    iPad Proportrait1366102412581024134610241366102411
                    iPad Prolandscape102413669161366100413661366102411
                    • 7. Re: Script to Detect Devices-iPad Pro
                      eoin

                      Well then in your case your sorted until you get an iPad Pro and discover otherwise.

                      My point and it was my assumption that perhaps you were planing a different layout to take advantage of the larger screen size of the Pro. If that was the case relying on Else If [ Get ( WindowWidth ) ≥ 1024 to open a specific iPad Pro layout will also trigger when a iPad is in landscape mode.

                       

                      You can of course use the zoomed mode of the iPad Pro to display layouts sized for the iPads to display the same on the iPad Pro, or make full use of the anchor and sliding features in design mode for the layout.

                      • 8. Re: Script to Detect Devices-iPad Pro
                        jbante

                        If vs. Case (vs. Choose) is only relevant for branching logic in a calculation. The examples here are of scripts, where there is no Case, and If...Else If...End If provides identical branching behavior.

                        • 9. Re: Script to Detect Devices-iPad Pro
                          user14047

                          I'm sorry. I wasn't taking split view into consideration.

                          Let (
                            [
                            ~device = Get ( Device ) ; // 3 = iPad , 4= iPhone
                            ~screenHeight = Get ( ScreenHeight ) ;
                            ~screenWidth = Get ( ScreenWidth ) ;
                            ~screenSize = ~screenHeight + ~screenWidth
                            ] ;
                          
                            Case (
                            ~device = 1 or ~device = 2 ;
                              "Desktop" ;
                          
                            ~device = 3 and ~screenSize ≥ 2390 ;
                              "iPad Pro" ;
                            ~device = 3 and ~screenSize ≥ 1792 ;
                              "iPad" ;
                          
                            ~device = 4 and ~screenSize ≥ 1150 ;
                              "iPhone 6 Plus" ;
                            ~device = 4 and ~screenSize ≥ 1042 ;
                              "iPhone 6" ;
                            ~device = 4 and ~screenSize ≥ 888 ;
                              "iPhone 5"
                            )
                          )
                          
                          
                          

                           

                          DeviceWindowOrientationStatusAreaStateMenubarStateScreenH+WScreenHeightScreenWidthWindowHeightWindowWidthWindowDesktopHeightWindowDesktopWidthWindowContentHeightWindowContentWidth
                          iPadPortrait ( Full Screen )111,7921,0247681,0247681,004768916768
                          iPadPortrait ( Full Screen )011,7921,0247681,0247681,004768960768
                          iPadPortrait ( Full Screen )101,7921,0247681,0247681,004768960768
                          iPadPortrait ( Full Screen )001,7921,0247681,0247681,0047681,004768
                          iPadPortrait ( Split 75% )111,7921,0247681,0244381,004438916438
                          iPadPortrait ( Split 75% )011,7921,0247681,0244381,004438960438
                          iPadPortrait ( Split 75% )101,7921,0247681,0244381,004438960438
                          iPadPortrait ( Split 75% )001,7921,0247681,0244381,0044381,004438
                          iPadPortrait ( Split 25% )111,7921,0247681,0243201,004320916320
                          iPadPortrait ( Split 25% )011,7921,0247681,0243201,004320960320
                          iPadPortrait ( Split 25% )101,7921,0247681,0243201,004320960320
                          iPadPortrait ( Split 25% )001,7921,0247681,0243201,0043201,004320
                          iPadLandscape ( Full Screen )111,7927681,0241,0247687481,0246601,024
                          iPadLandscape ( Full Screen )011,7927681,0241,0247687481,0247041,024
                          iPadLandscape ( Full Screen )101,7927681,0241,0247687481,0247041,024
                          iPadLandscape ( Full Screen )001,7927681,0241,0247687481,0247481,024
                          iPadLandscape ( Split 75% )111,7927681,024694768748694660694
                          iPadLandscape ( Split 75% )011,7927681,024694768748694704694
                          iPadLandscape ( Split 75% )101,7927681,024694768748694704694
                          iPadLandscape ( Split 75% )001,7927681,024694768748694748694
                          iPadLandscape ( Split 50% )111,7927681,024507768748507660507
                          iPadLandscape ( Split 50% )011,7927681,024507768748507704507
                          iPadLandscape ( Split 50% )101,7927681,024507768748507704507
                          iPadLandscape ( Split 50% )001,7927681,024507768748507748507
                          iPadLandscape ( Split 25% )111,7927681,024320768748320660320
                          iPadLandscape ( Split 25% )011,7927681,024320768748320704320
                          iPadLandscape ( Split 25% )101,7927681,024320768748320704320
                          iPadLandscape ( Split 25% )001,7927681,024320768748320748320
                          DeviceWindowOrientationStatusAreaStateMenubarStateScreenH+WScreenHeightScreenWidthWindowHeightWindowWidthWindowDesktopHeightWindowDesktopWidthWindowContentHeightWindowContentWidth
                          iPad ProPortrait ( Full Screen )112,3901,3661,0241,3661,0241,3461,0241,2581,024
                          iPad ProPortrait ( Full Screen )012,3901,3661,0241,3661,0241,3461,0241,3021,024
                          iPad ProPortrait ( Full Screen )102,3901,3661,0241,3661,0241,3461,0241,3021,024
                          iPad ProPortrait ( Full Screen )002,3901,3661,0241,3661,0241,3461,0241,3461,024
                          iPad ProPortrait ( Split 75% )112,3901,3661,0241,3666391,3466391,258639
                          iPad ProPortrait ( Split 75% )012,3901,3661,0241,3666391,3466391,302639
                          iPad ProPortrait ( Split 75% )102,3901,3661,0241,3666391,3466391,302639
                          iPad ProPortrait ( Split 75% )002,3901,3661,0241,3666391,3466391,346639
                          iPad ProPortrait ( Split 25% )112,3901,3661,0241,3663751,3463751,258375
                          iPad ProPortrait ( Split 25% )012,3901,3661,0241,3663751,3463751,302375
                          iPad ProPortrait ( Split 25% )102,3901,3661,0241,3663751,3463751,302375
                          iPad ProPortrait ( Split 25% )002,3901,3661,0241,3663751,3463751,346375
                          iPad ProLandscape ( Full Screen )112,3901,0241,3661,3661,0241,0041,3669161,366
                          iPad ProLandscape ( Full Screen )012,3901,0241,3661,3661,0241,0041,3669601,366
                          iPad ProLandscape ( Full Screen )102,3901,0241,3661,3661,0241,0041,3669601,366
                          iPad ProLandscape ( Full Screen )002,3901,0241,3661,3661,0241,0041,3661,0041,366
                          iPad ProLandscape ( Split 75% )112,3901,0241,3669811,0241,004981916981
                          iPad ProLandscape ( Split 75% )012,3901,0241,3669811,0241,004981960981
                          iPad ProLandscape ( Split 75% )102,3901,0241,3669811,0241,004981960981
                          iPad ProLandscape ( Split 75% )002,3901,0241,3669811,0241,0049811,004981
                          iPad ProLandscape ( Split 50% )112,3901,0241,3666781,0241,004678916678
                          iPad ProLandscape ( Split 50% )012,3901,0241,3666781,0241,004678960678
                          iPad ProLandscape ( Split 50% )102,3901,0241,3666781,0241,004678960678
                          iPad ProLandscape ( Split 50% )002,3901,0241,3666781,0241,0046781,004678
                          iPad ProLandscape ( Split 25% )112,3901,0241,3663751,0241,004375916375
                          iPad ProLandscape ( Split 25% )012,3901,0241,3663751,0241,004375960375
                          iPad ProLandscape ( Split 25% )102,3901,0241,3663751,0241,004375960375
                          iPad ProLandscape ( Split 25% )002,3901,0241,3663751,0241,0043751,004375
                          DeviceWindowOrientationStatusAreaStateMenubarStateScreenH+WScreenHeightScreenWidthWindowHeightWindowWidthWindowDesktopHeightWindowDesktopWidthWindowContentHeightWindowContentWidth
                          iPhone 5Portrait11888568320568320548320460320
                          iPhone 5Portrait01888568320568320548320504320
                          iPhone 5Portrait10888568320568320548320504320
                          iPhone 5Portrait00888568320568320548320548320
                          iPhone 5Landscape11888320568568320320568252568
                          iPhone 5Landscape01888320568568320320568286568
                          iPhone 5Landscape10888320568568320320568286568
                          iPhone 5Landscape00888320568568320320568320568
                          DeviceWindowOrientationStatusAreaStateMenubarStateScreenH+WScreenHeightScreenWidthWindowHeightWindowWidthWindowDesktopHeightWindowDesktopWidthWindowContentHeightWindowContentWidth
                          iPhone 6Portrait111,042667375667375647375559375
                          iPhone 6Portrait011,042667375667375647375603375
                          iPhone 6Portrait101,042667375667375647375603375
                          iPhone 6Portrait001,042667375667375647375647375
                          iPhone 6Landscape111,042375667667375375667307667
                          iPhone 6Landscape011,042375667667375375667341667
                          iPhone 6Landscape101,042375667667375375667341667
                          iPhone 6Landscape001,042375667667375375667375667
                          DeviceWindowOrientationStatusAreaStateMenubarStateScreenH+WScreenHeightScreenWidthWindowHeightWindowWidthWindowDesktopHeightWindowDesktopWidthWindowContentHeightWindowContentWidth
                          iPhone 6 PlusPortrait111,150736414736414716414628414
                          iPhone 6 PlusPortrait011,150736414736414716414672414
                          iPhone 6 PlusPortrait101,150736414736414716414672414
                          iPhone 6 PlusPortrait001,150736414736414716414716414
                          iPhone 6 PlusLandscape111,150414736736414414736346736
                          iPhone 6 PlusLandscape011,150414736736414414736380736
                          iPhone 6 PlusLandscape101,150414736736414414736380736
                          iPhone 6 PlusLandscape001,150414736736414414736414736