PDA

View Full Version : Simple??? Trigger Script


ABC123

Larry Sandberg
06-03-2000, 06:13 AM
I have a simple db called splits
fields: adv C 4
byd C 4
rev n 7 2
amt n 7 2

I want to set up an adv exit trigger script that will set
a the script variable %adv to the value of adv when adv="TTTT".

The exit trigger script reads as follows:

{set %adv," "}
{if adv="TTTT",{set %adv,adv},{beep}}

When entering data, upon exiting the field adv, I get the error message "A trigger script may not play back keys directly, use the Trigkeys command."

I am not trying to play back keys! What am I doing wrong?

Thanks for help.

Larry

csda1
06-03-2000, 08:59 AM
Larry,

You left out extra pairs of braces. The correct syntax is;

{set %adv," "}
{if adv="TTTT",{{set %adv,adv}},{{beep}}}

Regards,

Ira J. Perlow
Computer Systems Design & Associates
csda@mediaone.net

Ken Fleming
06-03-2000, 06:25 PM
I got the same messages too. I had not saved the Trigger to a file, then put the FILE name in the EXIT trigger. When I saved it to a file NAME it worked great. This puzzeled me for a LONG time.

Ken

Ken L Herrold
06-04-2000, 09:26 AM
Look guys, I don't want to be picky, but shouldn't we have trig_keys somewhere........ I.E.

{trigkeys {
{set %adv," "}
{if adv="TTTT",{{set %adv,adv}},{{beep}}}
}}

Without those, I always get that message.

Say, fellas, It seems that one of the patch upgrades for ver 6 had a reame that suggests Trigger be on ENTRANCE rather than EXIT. They've always worked either way for me.

Ken H

Augusto del Castillo
06-04-2000, 11:08 AM
Ken is right, guys.

Augusto del Castillo

csda1
06-04-2000, 01:10 PM
Ken,

No {trigkeys} is only used to play keys into the key buffer (and it actually occurs after the trigger script ends). The code with the correct number of braces is doing a {SET} and {BEEP} script commands, not playing back keys into the keyboard buffer. Without the extra braces, it is trying to type the letters

S E T % A D V , " "

or

B E E P

into the keyboard buffer. If that's waht you wanted to do, then you must use TRIGKEYS in the trigger script to place the keys there.

Regards,

Ira J. Perlow
Computer Systems Design & Associates
csda@mediaone.net

Ken L Herrold
06-04-2000, 01:12 PM
Touche' Ira

Ken

Robert Picard
06-05-2000, 08:23 AM
Hi Larry

You do not say if trigkeys plays the keystokes directly or by invoking a script. So here are my ideas.

The excellent reponses you have recieved highlight a problem I have had with "TRIGKEYS", that is setting the number of the brackets {} correctly.

My solution was to avoid the problem by always having "TRIGKEYS" play a script.

i.e. {trigkeys, {{play my_script}}}

Even if it only involves one keystroke I create a script for it. That way if I need to expand the actions in a trigger event, i.e. case or if statements, I avoid the problem of balancing the brackets {}.

Hope this helps Robert.

Larry Sandberg
06-06-2000, 04:01 PM
Thanks, Ira.
I never thought about all the curly braces. I coded it and it works perfectly. Thanks for all the replies. You learn something new everyday.

Larry