Jalz Posted April 15, 2004 Posted April 15, 2004 Hi I have downloaded the troi acrtivator plugin to trigger scripts when exiting a field. I have managed to make the following code work: External("Actr-ScheduleEvent"; "-addSingleEvent|" & Status(CurrentDate) & "|" & Status(CurrentTime) & "|" & Status(CurrentFileName) & "|Trigger Script|" & Status(CurrentRecordID) & "|Jalz") However if I wanted to run the script after 10 seconds of the field exiting would that be possible? I would also like to know if there is a way to trigger this script if the recolrd had been modified. At the moment the script depends on whether a field has been modified. Kindest regards Jalz FileMaker Version: 6 Platform: Mac OS X Panther
CobaltSky Posted April 15, 2004 Posted April 15, 2004 Hello Jalz, [color:"blue"] However if I wanted to run the script after 10 seconds of the field exiting would that be possible? Yes. Simply use: External("Actr-ScheduleEvent"; "-addSingleEvent|" & Status(CurrentDate) & "|" & (Status(CurrentTime) + 10) & "|" & Status(CurrentFileName) & "|Trigger Script|" & Status(CurrentRecordID) & "|Jalz") [color:"blue"]I would also like to know if there is a way to trigger this script if the recolrd had been modified. Yes. Create a time field called 'ModTime' and set it to auto-enter the modification time. Then define a stored calculation field with the formula: Case(ModTime, External("Actr-ScheduleEvent"; "-addSingleEvent|" & Status(CurrentDate) & "|" & (Status(CurrentTime) + 10) & "|" & Status(CurrentFileName) & "|Trigger Script|" & Status(CurrentRecordID) & "|Jalz")) It will trigger once, immediately after the record is exited, on each occasion when the record has been modified.
Jalz Posted April 15, 2004 Author Posted April 15, 2004 Thanks Ray, Worked a treat, the 10 second script, im going to try the modtime trigger in a bit. Just wondering if I should delete a script event (from the plugins memory) once I execute it, and if so is there a way to do this automatically? Im wondering this as at the moment, i have the trigger on all 100 fields duh- however with your modtime function, i should be able to reduce the number of times it executes. Best regards Jalz FileMaker Version: 6 Platform: Mac OS X Panther
CobaltSky Posted April 15, 2004 Posted April 15, 2004 Hi Jalz, Yes, you should delete the event from memory after it has been triggered. Otherwise you will eventually reach a memory buffer overflow. And yes, it can be done automatically. One way is to place a call to the plug-in as an additional step within the script which the external function is programmed to call, with the syntax: Set Field ["gResultTxt", "External("Actr-DeleteEvent", "-DeleteLastTriggered")"] Which will take each event out of memory as soon as it has been called. Unles you need to track a history of recently called events (eg for debugging purposes) then this shoudl perhaps be the first step in each script that Activator calls. Even if you do want to track events, I suggest that you have your scripts write the event ID and related details to a log field as their first step and then call Actr-DeleteEvent the above as the second step. That way your management of the memory space will be optimal.
Jalz Posted April 15, 2004 Author Posted April 15, 2004 Hi Ray, Tried the ModTime field as you decribed, it only seems to execute the script, once I click into the ModTime field (which is defined as a autoenter modified time field). Im wondering whether I should take it off the layout? In the Validated by calculation field i've typed in Case(ModTime, External("Actr-ScheduleEvent"; "-addSingleEvent|" & Status(CurrentDate) & "|" & Status(CurrentTime) & "|" & Status(CurrentFileName) & "|Trigger Script|" & Status(CurrentRecordID) & "|Jalz")) What do you think I am doing wrong? Thanking you in advance Jalz
CobaltSky Posted April 15, 2004 Posted April 15, 2004 Hi Jalz, If you look again at my original post, you'll see that what I was suggesting was that you place the formula into a separate stored calcualtion field. It will not work as a validation calc - auto entry options are not validated.
Jalz Posted April 15, 2004 Author Posted April 15, 2004 Thanks Once again Ray, Got it to work...I need to spend some time at the optician! My Stored calc field, Ive made it text, that should be ok presumably? Have a nice day. Jalz
Recommended Posts
This topic is 7596 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now