Jump to content
Sign in to follow this  

FM12, OnObjectKeystroke, and barcode scanner no longer working

Recommended Posts

I've run across a really odd situation and wanted to see if anyone else has either experienced the same, or can provide a solution.

A field on a List View layout has the OnObjectKeystroke script trigger. The script checks the Get ( TriggerKeystoke ), and will either go the next record or the previous one if the appropriate key was typed. Works perfectly fine when using the keyboard, but when I use a scanner, every time not all of the symbols come through into the field. It appears that the system isn't able to handle the scripting and all of the characters in such a rapid succession. When I take the script trigger off, then all of the scan shows up in the field.

The original intent of this to be able to scan barcodes in rapid succession into already existing records, without the user having to navigate using the keyboard/mouse. In my specific situation, the scanner is sending the CR code as a suffix, and FM is using that as a trigger to go to the next record.

The funny thing is that this setup worked perfectly fine in FM11. :getlost: Something has changed with FM12, but I haven't been able to find anything confirming this. It's like some kind of background process is delaying the scripting enough to cause problems. I originally thought that it might have something to do with the layout conversion from 11 to 12, but even building up a brand new layout/script gives the same results. It doesn't matter what computer I use this on or what type of barcode scanner, so it's definatly a problem with FileMaker.

I've tried to program other methods to get this functionality to work, but have failed so far. Any ideas??

Share this post

Link to post
Share on other sites

Yup, got the same thing. I wrote a 4 line trigger script and it failed using both a mag stripe reader and bar code reader.

I called FM support, but they are claiming that they do not support 3rd party devices. I can actually make it happen when I very quickly run my finger across a row of keys on a regular old keyboard.

I don't get why it doesn't work correctly since the standard size of the keyboard buffer in the operating system on most machines is 100 characters...way above what a barcode scanner puts out on a single read.

I have a workaround that is good for some problems, but not all. The workaround does a one second pause in a loop after setting up the data. After each second, the loop code checks to see if there are any interesting characters in the input field from a bar code reader or mag stripe reader. If there is, it exits the loop and sets a variable with an indication of what caused it to exit, else it continues to do its 1 second pause in the loop. The problem with this is if a termination character never comes up, it will loop forever. It wouldn't be too hard to put a timeout in the loop by counting the loop iterations and exiting the loop after a certain number of iterations. Hope this helps...

This does not solve all the problems, though. We have our barcode readers programmed with a preamble that I pick off in a layout trigger (OnLayoutKeystroke) that looks at every character. If it finds the preamble, it knows it's a UPC and makes an item entry. The timeout loop could work for this but it would be very messy.

Please keep me posted if you find any workaround and I'll do the same.. For me, it would be lots of rewriting and also a loss of functionality, as far as I can figure.

Share this post

Link to post
Share on other sites

First time poster, but have gathered so much information from all of you over the years I am happy to be able to provide some information. We have a bar code scanner that we use to track the members as they enter our facility. Used OnObjectModify (or OnObjectKeystroke can't remember) script trigger in FM 11 for two years without a glitch. Converted to FM 12 and couldn't get it to work. Same problem, would only read some of the numbers.

Just through trial and error realized if I switched the script trigger to be OnObjectSave and added a "tab" to the end of what the bar code sends it worked great. Hopefully this works for all of you.

Share this post

Link to post
Share on other sites

I have the same behavior, but only on windows (on Mac this still works fine).

Adding a global field (and set Enter and Return as going to next field) and OnObjectSave was the workaround.

Share this post

Link to post
Share on other sites

I'm glad to hear I'm not the only one experiencing this. I've already submitted a bug report to FileMaker Inc. but they'll probably ignore it. The only possibility that I can think would cause this is the additional event handling that FM now has to do in v12.

The workaround that I found to work was the same thing andries suggested. Most scanners you can program to put a carriage return (character #13) after the number scan (if it isn't that way by default), which will trigger going to the next field. But this restricts the script from evaluating a single character at a time, which is upsetting.

Share this post

Link to post
Share on other sites

I found this out to my peril as well this week.


Our EPOS system which we have written in house suffered the same problem after converting to FM12 

I've changed the global field script trigger from onObjectKeystroke to onObjectSave

This works but remember that whatever script you call you will need a way to exit it (or everytime to try to move out of the field you will trigger the script and probably bring focus back to your original field - as with our EPOS where you want to scan multiple times!)


Remeber you can cancel the scriptTrigger effect with an exit script 1 or 0 depending on your desired outcome.



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By Scott Pon
      Environment: FM13 with FM13 Server, mix of Windows 7 and 10.
      Is there a way to set a script trigger on if this portal row is new? IE, a script to run if this new child/portal record is new.  
      We have a parent record, and portal to Children records.  The children records have 2 fields: Profile Name and Process type.  Our user would like to enter a new child record (profile name and process type).  if the process type already exists, we will need to archive the existing record (matching the profile type).  There is more bI want to start with this first.
      I see script triggers to the layout "OnRecordCommit", but no similar script trigger for portals.  Any ideas on how to handle this?  Or am I going to have to add a button to go to another screen to accomplish this?
      Thanks.  I hope i gave enough info for you to help me.
    • By dav1089
      I want to create a script trigger which opens a layout based on account name ,create new record and put cursor in first field of the new record
      Now, I was able to direct user to specific layout and also created new record using New Record/Request function but somehow it doesn't put cursor in the first field , instead it selects whole record .
      Note: I also have script triggers attached to first and second field which runs on exiting the fields. (I don't think they affect anyways , but just mentioned to give idea)
    • By CRexen
      Hello everyone
      I am currently working on a database, which HR-Managers can access via WebDirect using login-information, to accede or resign their employees.
      I have made 6 possible option types for the HR-employees to enter data into, set by an unique ID, but with the use of the same fields.
      X fields with option type 1 (Accede)
      Y fields with option type 2 (Resign)
      Z fields with option type 3 (Maternity leave / leave)
      .. Etc. 6 option types in total.
      Now, based on my project description, a couple of the fields will have to be validated / not empty, which the HR-manager is prompted to enter before the record can be committed.
      Now, I am aware of FileMaker has it's own Field Validation, but I think the built in feature is bonkers..... (Sorry FileMaker..) 
      Therefore I was thinking of making a script to each of the different fields, which needs validation, and is this even a good solution
      Question one; how do I do this, the most easily? Is it possible?
      I have 8 required fields for validation, fields are global.
      Fields such as; Company Name, HR-manager name, HR-manager e-mail, employee SSN, employee name, employee surname etc. 
      I don't want the scripts to interfere with the other option types ( X, Y, Z ) which each is set by an unique ID, as well as fields, although the fields used in these option types are from the same table.
      Please see attached images of my setup.
      Hope you can help me, for the best possible solution.
      If you need more information, let me know.
      P.S. The language/text on the layout is Danish, although shouldn't be considered an issue for understanding my problem.

    • By Dana G
      Purpose:  To capture the contents of a field before it is changed.  Compare the before to the after.  Highlight the after and screen capture then export.
      I can't get past the first sentence and it's getting frustrating because it seems extremely simple.
      1 Field:  OnDeck_t (text)  -  The OnDeck_t field data = On
      2 Field:  OnDeck_before (Where I want to capture the OnDeck_t before it's changed)
      I have an OnObjectEnter script trigger on the OnDeck_t field that runs this script:
      Set Field By Name [substitute (Get (ActiveFieldName); "_t"; "_Before"); Get (ActiveFieldContents)]
      If I do this it works fine.  (But I don't want it hard coded.  I will be using it for all the fields on the layout):
      Set Field [OnDeck_before; Get (ActiveFieldContents)]
      I have divided the Substitute (Get (ActiveFieldName); "_t"; "_Before") and Get (ActiveFieldContents) into separate lines in Data Viewer and both return expected results.  Why doesn't it work when it's part of a 'Set Field by Name' script step?
    • By scoony
      I'm new to the forum so apologies if I have put this question in the wrong section.
      What I am attempting to do: I want to create a 'home page' that each consultant sees when the database opens on an iPad. The home page should have two pop-up menus, Client and the other Contact. For context, each Client with have multiple Contacts (generally employees and contractors) The consultants in the office want to be able to navigate to a Client they select from the pop-up menu on the 'home page'. The same process applies to the Contact pop-up menu. 
      Many thanks if anyone has ideas how to achieve this. 
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.