flapjacks Posted January 21, 2006 Posted January 21, 2006 I must be stupid but I can't get this (what seems to be basic) plugin to work. I have an invoices detail table. I want when I change and exit Field3 for it to trigger a script. Thanks for any help you can give. John
Inky Phil Posted January 22, 2006 Posted January 22, 2006 Johhny boy Here is the thread that got me going when I had the same problem. Hope it helps Phil http://fmforums.com/forum/showtopic.php?tid/170003/tp/0/all/1/
Søren Dyhr Posted January 22, 2006 Posted January 22, 2006 exit Field3 for it to trigger a script. What does the script do, perhaps it's posible without the plugin in the first place? I mean I've caught you before thinking scripting when ...relations were the name of the game This time could it be multiline keys instead of batch creation of join table records?? --sd
flapjacks Posted January 22, 2006 Author Posted January 22, 2006 Thanks Phil. Soren I have a weight/piece sold field that must be compared to a high field and a low field. If the entered weight falls outside of these two fields I show a message box giving the option to change the entered weight or keep it. I run it now at the end of the invoice with a button but my users want it to check the weight as they leave the field. John
flapjacks Posted January 22, 2006 Author Posted January 22, 2006 Phil I enjoyed that thread. I could have written it! When my head stops hurting later I will make another go at it. The way I have it now it works great but NOOOOO my users want it their way. Users suck. John
Søren Dyhr Posted January 22, 2006 Posted January 22, 2006 If the entered weight falls outside of these two fields I show a message box giving the option to change the entered weight or keep it. Why can't it be done with a native validation, perhaps you're jumping to conclusions if you think native only follows each individual field. Investigate the attachment, do you still have a need for scripting? --sd Valid.zip
flapjacks Posted January 22, 2006 Author Posted January 22, 2006 Soren Many thanks! It looks like I can use your example. I agree, why use plugins unless necessary. That's why I posted sometimes you can't see the forest thru the trees. John
Søren Dyhr Posted January 22, 2006 Posted January 22, 2006 Before you ask, might I turn the attantion to this ...where the pseudo trigging happens! --sd
Matt Klein Posted January 23, 2006 Posted January 23, 2006 Soren Many thanks! It looks like I can use your example. I agree, why use plugins unless necessary. That's why I posted sometimes you can't see the forest thru the trees. John With all due respect to Soren and based on your post that stated the users wanted to be told on field exit, I don't believe a validation will be quite what you need. The problem is that, unlike FileMaker 6 and below, FileMaker 7/8 does not validate fields on field exit. Instead, field validation doesn't happen until the user tries to commit the record. I believe that an Auto-Enter calc is your best bet.
flapjacks Posted January 23, 2006 Author Posted January 23, 2006 So far no joy. I'm about half way there. I still need to run that script on exiting the field. I need to show a message, give a choice on change or overide, log any overides. John
Søren Dyhr Posted January 23, 2006 Posted January 23, 2006 The problem is that, unlike FileMaker 6 and below, FileMaker 7/8 does not validate fields on field exit. Instead, field validation doesn't happen until the user tries to commit the record. Ah yes you're right, but having lines being drawn under entries, have some atrifacts as well. Say you draw a massive in red if the entry is outside the range as this: LeftWords(Substitute(10^20-1;"9";"g");Evaluate ( UpperLimit < theEntry or LowerLimit > theEntry; theEntry )) ...this techniques exploits the webding font, where "g"'s in a series makes a massive unbroken line of boxes. It's the same expression from before it's just deMorgan'ed to keep "silent" when the entries are within. The snag is that in editmode isn't fields tranparent. But otherwise a swift and neat way to communicate errors with the user. But it's hardly a dialogbox? --sd
Matt Klein Posted January 23, 2006 Posted January 23, 2006 So far no joy. I'm about half way there. I still need to run that script on exiting the field. I need to show a message, give a choice on change or overide, log any overides. John I think your best bet here is to keep the mind set you started with which was to run a script using a plug-in call in an auto-enter calculation. I do it when neccessary. I don't know which script triggering plug-in you are using, but I use SecureFM's PerformScript function since I already have a developer's license for it. The syntax for the auto-enter calc looks something like this: Field3 & External("PerformScript", "ScriptName") It is important to include the field itself in the auto-enter calc otherwise the field will be cleared or changed to a returned result from the plug-in. It is also very important to make sure you uncheck the "Do not replace existing value for field (if any)" check box.
flapjacks Posted January 24, 2006 Author Posted January 24, 2006 Thanks Matt. All help is appreciated. John
flapjacks Posted January 25, 2006 Author Posted January 25, 2006 Matt I downloaded securefm after much brain wear. Took 5 minutes to make it do as I wanted. Thanks! To everyone else who took the time to help with this, many thanks. John
Matt Klein Posted January 25, 2006 Posted January 25, 2006 Glad I could help. SecureFM is pretty expensive, but you get alot for it. What plug-in were you trying to get to work? I would be happy to see if I can get it to work in the same fashion as SecureFM.
flapjacks Posted January 26, 2006 Author Posted January 26, 2006 Matt It's well worth the price. I was trying to get EventScript to work. SecureFM was very easy, very good documentation. I purchased a ten user license. It will pay for itself quickly. I develope for my own use. Thanks for the tip. Thanks, John
Homer Posted January 26, 2006 Posted January 26, 2006 OH! I'm too busy with clients to follow each threads on every forums and lists... Sorry Mr. Johnnyboy for being a bit late. Because I'm sure your question has a very simple answer and you should find it at this address : http://www.softs4humans.com/support/eventscript_faq.htm The after-update (on exit) event is the more frequently used and EventScript can make this simple task very easily and very efficiently. Sure, SecureFM is really a great PI and I don't want to say a single word against it. But if your need was simply to have a way for triggering scripts automatically, I think you just throw away 259.95 US dollars! :
Matt Klein Posted January 26, 2006 Posted January 26, 2006 I agree Homer. If all John wanted to do was run a script on field exit, then EventScript would be the best choice since it is free. John - make sure you check out the ContextChange and HotKey functions. ContextChange let's you run scripts automatically whenever you change windows, layouts, table occurence, or file and HotKey lets you assign scripts to any key or combination of keys including the function keys. No, I don't work for New Millennium. I know you all were wondering. I have just been using SecureFM for a long time and it's an integral part of most of my solutions.
flapjacks Posted January 26, 2006 Author Posted January 26, 2006 I just wanted the script trigger, however the other functions that come along with it are worth it to me. Nothing against EventScript, I just could not wrap my head around it. Thanks again, John
Matt Klein Posted January 26, 2006 Posted January 26, 2006 Well, I just messed around with EventScript and the syntax is basically the same as with SecureFM. Field3 & S4HU_EventScript( Get(FileName) ; "ScriptName" ; "" ) Not easy to tell what the third parameter can be from the documentation, but if you leave it as quotes all will work fine. The only real difference is that SecureFM doesn't require the specification of a File Name, it's optional. The benefit of this seems to be that if the field you are triggering the script from is defined in another file, not the one you are currently in, and you use the EventScript plug-in you must specify the file you are currently in as the "Get(FileName)" parameter. If you use the FileMaker function Get(FileName) as the "Get(FileName)" parameter it will only run the script if it is in the file that the field is defined in. This is not so good if you place this field on layouts in several different files. In that situation with SecureFM, if you don't specify the file name, it will perform the script specified in the "ScriptName" parameter in whichever is the current file. This means, you could have different behaviors after editing a field in different files by defining scripts in each file with the same script name.
Homer Posted January 27, 2006 Posted January 27, 2006 Not easy to tell what the third parameter can be from the documentation, but if you leave it as quotes all will work fine. The third parameter for EventScript is actually the parameter(s) for the script you want to trigger. For example S4HU_EventScript ( "Invoices"; "PrintInvoice"; 401 ) will trigger the script PrintInvoice from the file named Invoices and this script will receive the script parameter 401 (let's say the invoice number to print in this case). If the developer want to pass more than one parameter to the target-script, then he can use the 'CRLF character' to separate each script parameters. Here's an example for passing multiple hardcoded script parameters: Parameter1¶parameter2¶parameter3 Textual parameters should be place between quotes. If you have no parameter to pass to the target script, then simply enter "" (that's double-quote) as the 3rd parameter. HTH.
Matt Klein Posted January 27, 2006 Posted January 27, 2006 Thanks Homer for clearing that up. That's a great feature.
Claus Lavendt Posted January 28, 2006 Posted January 28, 2006 Just a comment on the optional parameter: S4HU_EventScript( FileName ; ScriptName ; OptionalScriptParams ) The Optional parameter is a script parameter. This can allso be calculated, eg based on the layout you are on etc. By the way, this work very nice. Another free plugin, that does the same is Zipp script. Zipp Script even has another feature: zippScript_PerformScript accepts four parameters, two of which are optional. FileName and ScriptName are required parameters that identify the script to be run and must be an exact match for those names. The target script may be in any open file. An unknown file or script name will return an error. ScriptParameter is optional and may contain any calculated result, including the empty parameter "". ScriptControl is optional and may contain the values 0, 1, 2, 3 or the equivalent text Halt, Exit, Resume, Pause. An unknown value will return an error. http://homepage.mac.com/jkornhaus/
Recommended Posts
This topic is 6942 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