[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

FM - Request for Scripting Timesaving Suggestions

Posted on 2011-05-09
4
Medium Priority
?
279 Views
Last Modified: 2012-05-11
Had a little project that I thought would take me an hour and ended up taking about 4.  I was to create a new table and pull it back into an existing layout so agents can mark whether someone stood them up on an appointment.  Question:  How do you organize scripts, calcs, etc., to save time?  Use custom functions frequently?  I've also heard something about macro scripts.  I'm new at this.  I'm asking for suggestions, so, of course, there is no right answer.
0
Comment
Question by:rvfowler2
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Will Loving
ID: 35722446
It's a broad question and the answer - as always - depends on your goals. I'm not sure what is meant by "Macro scripts" but perhaps it's referring to "Master" scripts? I have a set of 50+ "Master" scripts that do various common functions. The advantage to this kind of "modularization" is that if you ever want to change something, you just change it in one place...the master script.

For example, I have several printing related scripts the do such things as set Page Setup to US Letter/Portrait, show the Status Area, Go to Preview, Pause, Print and then Close the Window. When running a report that needs to be in US Letter Portrait mode, I would use the New Window and Go to Layout script steps to get to the report layout, and then just run the Master script to do the rest. i have similar scripts for US Letter Landscape, US Legal Portrait, A4 Portrait etc as well as options to skip the Preview and just print.

While I have separate Master Scripts for these various print operations, it would be quite possible to simply have one Master Print script and to pass various Print Parameters to the script using script variables for Page Size, Orientation, Preview, Show Print Dialog, etc. I can go into that more if you wish. In general, using script parameters is a great way to reduce scripting. You have a relatively generic script and then specify what it is supposed to do when you click *this* button via the script parameters.

The same thing can be done using Custom Menus. If you have a lot of reports, you can create a "Reports" menu. Each menu item calls the same Reports script but the script variable tells it which report to run.

Custom functions can also be incredibly useful in the same way as modularizing scripts. Instead of doing same calculation for something like formatting currency or percentage as text, you use a Custom Function and just call the function.

If you want more details on any specific part of this let me know.

0
 
LVL 2

Author Comment

by:rvfowler2
ID: 35723653
Thanks.  I am comfortable with script parameters and use them often (reports, navigation, etc.), as well as custom menus.

Yes, I was referring to Master scripts and I think I understand your concept, but maybe an example would ensure I understand.  Also, any suggestions of where to use custom functions would be appreciated; I only use it currently for phone number formatting.  

One other example I was thinking of was the email script.  I always copy that and never reenter all the config info.

Thanks.
0
 
LVL 25

Accepted Solution

by:
Will Loving earned 2000 total points
ID: 35724546
The attached file contains a set of possible "Master Scripts". This is not a definitive set nor is it even what I would use these days if I were designing something that would only be used in FM 11 and later, but it should give you some ideas. As noted above, the Print scripts in particular could be consolidated into a single script with the action determined using "named" script parameters, something I'll may write a short article on. Most of the scripts do not reference any fields, or layouts at all except via script parameter or calculation.

A few notes:

Some of the most useful scripts in here are for window management, including:

Create New Window OFF-screen
Create New Window ON-screen
Move Current Window OFF-screen
Center Window ON-Screen

I use these all the time.

There a group of 'generic' Find scripts that can be used to manage a Find sequence from any layout, provided the layouts are named in a consistent manner. They work from the assumption that the main layout for each area of the database has a simple name such as "Contacts" or "Classes" and that the List View of that the respective List view for that table is called "Contacts List" or "Classes List", and if there is a special Find layout that is called, respectively "Contacts Find" and "Classes Find".

When determining what to do after a Find, if there is more than one record it always goes to the "List" version of the original layout, if there is only one record, it always goes to the single record view. It does this by noting the original name of the layout and adding or removing the word "List" for calculate where to go.

The one script that I have not cleaned up but left for you to ponder, is a generic script for an "Email PDF of Current Report". By using this as a sub-script in any report sequence, I can have a PDF created an emailed to a recipient.

The script could be modified to allow user entry of a email address via a dialog and it also has the option to either use the standard "Send Mail" option or to use SMTP. Since the script was created prior to FM's inclusion of SMTP emailing, and because I have to maintain backwards compatibility, it references the SMTPit Plugin rather than FM's SMTP send but that could be easily changed. You just need to have an Admin field somewhere that the user sets to determine which method of sending email you need.


Master-Scripts.fp7
0
 
LVL 2

Author Closing Comment

by:rvfowler2
ID: 35732694
Thanks Will, that's the type of thing I was looking for.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question