Brian Dunning's FileMaker Custom Functions

ModifiersOn ( keys )

Returns whether modifier key-combination pressed.

  Average rating: 4.2 (22 votes) Log in to vote

Eric   Eric

Share on Facebook Share on Twitter

  Sample input:
ModifiersOn ( "Shift" )

ModifiersOn ( 9 )

ModifiersOn ( "Ctrl-Alt" )

ModifiersOn ( 0 )

ModifiersOn ( "" )
  Sample output:
1 when shift pressed

1 when shift-option pressed

1 when ctrl-alt pressed

0 when any modifier pressed

when all keys pressed

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

ModifiersOn ( keys ) ©2015 Eric Matthews, San Jose, CA :-)
Returns whether modifier key-combination pressed.

Returns 0 (False) if the modifier key or key-combination specified is not pressed
and 1 (True) if the key or key-combination specified is pressed,
or returns a list of variables flagged corresponding to keys pressed.

keys - number representing one or more modifier keys and/or a key name, or a combination of key names

Data type returned
number or text

Use this function to test whether a modifier key or specifiec combination of keys are pressed.
Specifying one key will test for that key only.
Valid values to specifiy key:
SHIft, 1;
CAPslock, 2
CONtrol, CTRl, 4
ALT, OPTion, 8
COMmand, 16
A single number can be specified to represent multiple keys. E.g. 31 = All keys pressed.
Or "Shift-Control-Alt" will test whether all three of those keys were pressed in combination.
A number can be specified in combination with names:
"3CtrlAlt" is the same as "Shift-CapsLock-Control-Option"
Also ModifiersOn(0) is True when no modifier keys are pressed, False when any modifier key is pressed.

Adaptions from custom functions ModifierVariables (©2009 Jeffanna Design) :
If keys is empty (e.g. ""), this function "...sets a series of local variables based on which modifier keys are being pressed, e.g.
If the shift key is being pressed, $ShiftOn = 1.
If the command key is not being pressed, $CommandOn = 0."

This function will then also return a list of those variables turned on.
Note: The output of this function with no key specified can be used to specify a key or key-combination for this same function.

ModifiersOn ( "Shift" ) = 1 when shift pressed
ModifiersOn ( 9 ) = 1 when shift-option pressed
ModifiersOn ( "Ctrl-Alt" ) = 1 when ctrl-alt pressed
ModifiersOn ( 0 ) = 0 when any modifier pressed
ModifiersOn ( "" ) =
when all keys pressed



Eric   Eric, SJSU
May 31, 2015
Modified 5/31/2015. I changed the alias "CTL" for "control" to "CTRL"

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.