You can trigger the script on an OnObjectModify or save script trigger possibly (Not sure how your barcode is interfacing with FM I dont use such things)
You could possibly just go to related record on the designated layout and use the related tables barcode scan on this layout
If your barcode scan field is updating in a particular layout the OnObjectModify Script trigger should do the trick.
Better than OnObjectModify is to use OnLayoutKeystroke.
Barcode scanners almost always operate in keyboard emulation mode which means that the computer thinks the data from the barcode was simply typed in. Almost all scanners can be programmed to preface the scanned data with text you can specify. Set up the scanner to preface the scan with some very unusual key combination and then write your script to use the Get (TriggerKeystroke) and Get ( TriggerModifierKeys ) to see if the keystrokes that tripped the trigger are the preface to some scanned text. If so, you can use go to field or go to object to put the cursor in the field you want to use to recieve the scanned text.
Then add tab, enter, or return as the final character added to the end of the scanned text. Set behavior on the field so that this key exits the field and use the OnObjectExit trigger to perform the script that uses the newly scanned data in whatever way you need to see this happen.
Thanks for the quick responses!
I guess I don't understand how to do that.
When I am in the "edit script" dialog box, I don't see how to add those as options to my script - Get (TriggerKeystroke) and Get ( TriggerModifierKeys )
The scanner is progrramed so that it reads the order_nember and enters it as text.
For Example.... I scanned order #000001 into word pad and it posted the number 000001 into the word pad document.
Read the documentation that comes with the scanner and learn how to add text to the beginning and end of the scanned text.
With a magnetic strip reader here, I've set it up to precede the text scanned from the strip with the shift, capslock and ~ characters.
My script then is written similar to this:
If[Get (TriggerKeystroke ) = "~" And Get ( TriggerModifierKeys ) = 3 ]
Go to Field [Table::Field] //specify the field you want to use to receive the scanned text
Exit Script [False] //This step cancels the actual keystroke event so that these "trigger keys" do not actually enter text into the field
cool thanks for the info! I'll do some homework on my scanner and see if I can make it work.
How do I set the trigger "OnLayoutKeystroke"? In my list of script triggers all of them listed are "OnObject...."
Enter layout mode. Open Layout setup... and click the script triggers tab.