April 13, 200223 yr Newbies I'm creating a script to perform a find based on manipulation of some fields entered by the user. This script then calls PerformFind[]. The script is currently attached to a button and works correctly. However, many end-users of the data base are likely to type the 'ENTER' key to start the find going, instead of clicking the button. How can I "trap" the ENTER key in a field so that it also starts the script?
April 13, 200223 yr You could just pause the script at the point where users enter the find criteria, then clicking ENTER will resume the script and execute the find. Russ
April 13, 200223 yr IOW, you make a script that goes to the Find layout, then Pause. Now the user can enter criteria, and the Enter key will continue the script... which can simply be to call your PerformFind[]. script.
April 14, 200223 yr Author Newbies Thanks for the tips! I've give the "paused script" method a try. On the face of it, it sounds like it will do what I want, although I'm just a little concerned at leaving a script "hanging around" in case another script is called (there are a few other buttons). But it should be okay. Expanding further on the first post, is trapping keystrokes the sort of thing that can be down with Plugins, or is it too low-level? Any Plugins on the market that offer such control?
April 14, 200223 yr There are plugins which will allow you to trigger a script on exiting a field - I think its one of Troi's but don't know the name. Leaving a script "hanging around" is not normally a problem. If you are single user, then a scripted button to execute another script is OK, and if you are running a file hosted from either a server or peer-to-peer, then its OK to have your script paused while others work - you may need to investigate record locking. Russ
April 14, 200223 yr If you are concerned about leaving a script "hanging around" here's a suggestion: Create a duplicate layout where the script is performed. Either disable the buttons for the other scripts (which can be confusing in some circumstances) or create a sub-script that runs at the beginning of the other scripts to check the layout name e.g. If(StatusCurrentLayoutName) = "Script Layout" ShowMessage "You are in the middle of blah blah. Click Enter to continue." Exit Script End If You can achieve the same without a duplicate layout by setting a global field on your normal layout with "script running" (or whatever) as the script starts. Test for this value at the beginning of the other scripts. And remember to set the global field to clear when the script completes.
April 14, 200223 yr One of the problems with placing a script into pasue mode is that another script can be run by a second user and which could interfere with a "resume script" command submitted by the first user. ScriptMaker is single-threaded, and this cannot be emphasized enough. If you do not mind the pause (because of a lack of likelihood of conflict with others) you may find the topic "multiple fields required for search" (last entry march 20, 2002), in the forum "Finding & Searching") to be useful.
Create an account or sign in to comment