From the guide Validate and fix your code by AI.
← ai2fm Guides · Download onFirstWindowOpen.fmscript
# ------------------------------------------------------
# ------------------------------------------------------
# Choose which is the current running PLATFORM
# 1 = if the current platform is Intel-based Macs
# -2 = if the platform is Windows
# 3 = if the platform is iOS
# 4 = if the platform is FileMaker WebDirect
Set Variable [ $$PLATFORM[1] ; Value: Get ( SystemPlatform ) ]
Set Variable [ $$PLATFORMTYPE[1] ; Value: Choose (
Abs ( $$PLATFORM );
"0";
"Mac" ;
"Windows" ;
"iOS" ;
"Web" ;
)
]
# ------------------------------------------------------
# Choose which is the current running DEVICE
# 0 = Unknown
# 1 = Mac
# 2 = Windows
# 3 = iPad
# 4 = iPhone
# 5 = Android Device
Set Variable [ $$DEVICE[1] ; Value: Get ( Device ) ]
Set Variable [ $$DEVICETYPE[1] ; Value: Choose (
Abs ( $$DEVICE ) ;
"Unknown" ;
"Mac Desktop" ;
"Windows Desktop" ;
"iPad" ;
"iPhone" ;
"Android" ;
)
]
# ------------------------------------------------------
# Get the Window Orientation In FileMaker Pro Advanced and FileMaker Go only, returns:
# -2 for landscape left
# -1 for landscape right
# 0 for square (FileMaker Pro Advanced and FileMaker WebDirect only)
# 1 for portrait
# 2 for portrait upside down
Set Variable [ $$WindowOrientation[1] ; Value: Get(WindowOrientation) ]
Set Variable [
$$WindowOrientationText[1];
Value: Case (
$$WindowOrientation = -2 ; "Landscape left" ;
$$WindowOrientation = -1 ; "Landscape right" ;
$$WindowOrientation = 0 ; "Square" ;
$$WindowOrientation = 1 ; "Portrait" ;
$$WindowOrientation = 2 ; "Portrait upside down"
)
]
# ------------------------------------------------------
# Set default visual states
# Get the Screen Hight and Width
Set Variable [ $$ScreenHeight[1] ; Value: Get ( ScreenHeight ) ]
Set Variable [ $$ScreenWidth[1] ; Value: Get ( ScreenWidth ) ]
Set Variable [ $$Screen[1] ; Value: $$ScreenHeight/$$ScreenWidth ]
# ------------------------------------------------------
# Set Version Number
Set Variable [ $$Version[1] ; Value: "1.0" ]
# Check Privilege
If [ Get ( CurrentPrivilegeSetName )= "[Full Access]" ]
Set Variable [ $$_DEVELOPER.MODE [ 1 ] ; Value: 1 ]
Else
Set Variable [ $$_DEVELOPER.MODE [ 1 ] ; Value: 0 ]
End If
# ------------------------------------------------------
Go to Layout [ “Dashboard” (Dashboard) ]
Adjust Window [ Resize to Fit ]
# ------------------------------------------------------
Truncate Table [ With dialog: Off ; Table: “myTable” ]
# ------------------------------------------------------