Have you tried using OnObjecyModify instead?
Trying this in Windows, I can't get onObjectKeystroke to fire at all with the Alt or Ctrl keys down. I can with shift, though. Have you tried a different modifier key?
OnObjecyModify doesn't help - The user is not making a modification which could trigger. The modifications are made by the script and there are three involved.
OnObjectKeystroke is (should be) much more elegant.
On a Mac shift, option and control all (mis)behave.
Perhaps you don't need to use two 'Trigger' functions?
If you are getting two script triggers and only require one, then what about replacing the 'Get ( TriggerModifierKeys ) = 8' with 'Get ( ActiveModifierKeys ) = 8'?
I haven't tried this, but it would be the next step that I would take ...
Best wishes - Alan Stirling, London UK.
unfortunately that doesn't work. FileMaker is still seeing two independent keystrokes and triggering the script twice.
I see this as a man-machine interface problem. That is because these are two separate keystrokes. But, it sounds like you're testing them as if they were simultaneous.
Use the ScriptTrigger OnObjectKeystroke, but have the script pause .5-1 sec. (or longer as hunt-and-peck typists take more time to locate the keys) before checking for the keys being down. This time lag allows for human reaction times.
I played with this a bit. Attached is the file. In this version, it navigates to the next or previous record depending on which arrow key (up or down ) is pressed. You must click on portal row. I used global variables to catch the keys pressed and count the number of times the script runs. If I ran it with the debugger opened it affected the result. So you can watch what is going on in the data viewer.
On my MacBook Pro I found the following:
- Holding the control key the script worked correctly
- Holding the alt (option) key the script ran twice
- Holding the command key prevented the script from running at all. This may be a result of an apple add on I have that shows keyboard shortcuts when the command key is held for an extended time.
- With no extra keys being held, it reported that option key 48 was being held down. This was the same using both Get ( TriggerModifierKeys) and Get(ActiveModifierKeys).
Anyway this sounds like a bug. I'm running FileMaker Pro Advanced 13.0v3 on OS X 10.8.5 on a Retina, Mid 2012 MacBook Pro.
Keystroke.fmp12.zip 68.0 K
An interesting test file Bruce. I tested it on a MacAir running FM13 and OSX 10.9.4 and can add to your results as follows:
• control + up and down arrows are both keyboard shortcuts used to toggle between Mission Control and Application windows, so the script does not fire at all. These shortcuts can be switched off, however—script then works correctly as per your test
• option key appears to cause script to run twice, as it jumps two portal rows. However, when run with debugger on it only runs once and moves one portal row
• command key prevents script running as you found, so it is not an Apple add-on. I couldn't find any way to switch this off, so maybe it's a reserved key or something of the sort
We all live and learn.
Thanks, Bruce, for your test file.
Just a note - FileMaker Help states: Get(TriggerModifierKeys) -> Notes -> Mac OS: Command key combinations do not activate script triggers.
In FM12 my script, and your test file, exhibits another behaviour. The script when triggered on the first portal row loops throught the entire portal, as though Go to Portal Row is triggering. Maybe this is well known.
I had said I was quite sure that my script worked as expected in FM 12. It must have been FM11 though. Unfortunately I can't test that.
As you say, eveything seems to point to this being a bug.