8 Replies Latest reply on Oct 16, 2016 2:07 PM by alfred1963

    Detecting iPad or iPad Pro at login..?

    abinning

      With the Boss having treated himself to an iPad Pro for Christmas, I now need to create specific layouts for both regular iPad and iPad Pro and detect which iPad at login...

       

      I have established that my new iPad Pro specific layouts will need to be 1366x1024 (landscape orientation without toolbars/menubar), however what is the best way to determine which iPad is being used at login..? I'm already using Get(Device) in my startup script but that obviously returns '3' regardless of the iPad screen size....

        • 1. Re: Detecting iPad or iPad Pro at login..?
          skywillmott

          How about:

           

          If [ Get(Device)=3 ]

               If [ (Get(WindowOrientation) > 0 and Get(WindowWidth) > 768) or (Get(WindowOrientation) < 0 and Get(WindowWidth) > 1024) ]

                    #iPad pro

               Else

                    #regular iPad

               End If

          End If

           

          • 2. Re: Detecting iPad or iPad Pro at login..?
            abinning

            Thanks for the prompt reply skywillmott – I was able to give this a very quick test before the Boss disappeared for the holidays and unfortunately it didn't work, but I have no idea why as it certainly made sense and looked like it should work just fine

             

            Testing shall resume w/c 4th January...

            • 3. Re: Detecting iPad or iPad Pro at login..?
              skywillmott

              Maybe try Get(ScreenWidth) instead of Get(WindowWidth)

               

              I don't have an iPad Pro to test it on unfortunately...

               

              Also, perhaps Get(Device) doesn't return '3' when using iPad Pro?? Instead, you could try using:

               

              PatternCount ( Get(ApplicationVersion) ; "Go" ) > 0

               

              So it would be:

               

              If [ PatternCount ( Get(ApplicationVersion) ; "Go" ) > 0 ]

                   If [ (Get(WindowOrientation) > 0 and Get(ScreenWidth) > 768) or (Get(WindowOrientation) < 0 and Get(ScreenWidth) > 1024) ]

                        #iPad pro

                   Else

                        #regular iPad

                   End If

              End If

              • 4. Re: Detecting iPad or iPad Pro at login..?
                abinning

                Thanks again – yes, I'm going to try a few of those suggestions once the Boss returns from holiday with his iPad Pro as I don't have one either...

                 

                I had tested a blank layout displaying just symbols for {{ScreenContentHeight}} and {{ScreenContentWidth}} as well as {{WindowContentHeight}} and {{WindowContentWidth}} so I think perhaps both Get(ScreenWidth) and Get(WindowWidth) might well return the same values... I hadn't thought about checking whether or not Get(Device) returned something other than '3' on iPad Pro.

                 

                With all the different iOS screen sizes, I wonder if I'm missing another simple, obvious way to detect specific devices at login...?

                • 5. Re: Detecting iPad or iPad Pro at login..?
                  rgordon

                  This calc should get you any iDevice no matter what the orientation

                   

                  Case(Get(WindowContentHeight) + Get(WindowContentWidth) ≥  2282;"iPad Pro";

                  Get(WindowContentHeight) + Get(WindowContentWidth) ≥  1684;"iPad";

                  Get(WindowContentHeight) + Get(WindowContentWidth) ≥  1042;"iPhone 6 Plus";

                  Get(WindowContentHeight) + Get(WindowContentWidth) ≥  934;"iPhone 6";

                  Get(WindowContentHeight) + Get(WindowContentWidth) ≥  780;"iPhone 5"; "iPhone")

                  • 6. Re: Detecting iPad or iPad Pro at login..?
                    user14047

                    Re: Script to Detect Devices-iPad Pro

                     

                    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"
                      )
                    )
                    
                    
                    • 7. Re: Detecting iPad or iPad Pro at login..?
                      abinning

                      Thanks – that should work a treat and I'll give it a whirl after the holidays

                      • 8. Re: Detecting iPad or iPad Pro at login..?
                        alfred1963

                        Thanks U1407 just what I needed,

                        all that is left to say is make it a global calculation only calculating when needed.