Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4 Basic Scripting. Administrative  Files on the website will be posted in pdf for compatibility  Website is now mirrored at:

Similar presentations


Presentation on theme: "Lecture 4 Basic Scripting. Administrative  Files on the website will be posted in pdf for compatibility  Website is now mirrored at:"— Presentation transcript:

1 Lecture 4 Basic Scripting

2 Administrative  Files on the website will be posted in pdf for compatibility  Website is now mirrored at: http://www.deltacollege.org/emp/ckirschenman/  Project 1 will be assigned next Friday  A sign in sheet for groups will go around today  Groups should contain from 2 to 3 people  Short lab today; finish lab 3

3 Summary Lecture 2  Fundamentals of good UI(user interface) design.  Different types of layouts  Designing Standard and Columnar pages  Part Setup (and printing pages)  Cool tips and tricks  Utilizing FileMaker graphics

4 Review  Any questions concerning previous material?

5 Topics  What are scripts used for  Designing scripts (before coding)  How to define scripts  Most useful script steps  Templates

6 What scripts are used for  Simplify the database for the user  Perform multiple steps with one script  Do manipulations on data that are not possible without scripts  Get information from the system  Build dynamic charts etc. The possibilities are endless

7 Designing scripts  Scripts can get very complicated, before you start do the following  Ask three important questions What is the problem Have I done something like this before How can I break this up(modularize)  If your script is going to be more than a couple lines write it out in plain English before you start scripting

8 Designing scripts  What is the problem Just like before when defining the problem for the database Don’t be afraid to put too much automation in a database as long as the automation is intuitive to the user  Have I done this before Save time use Script from before

9 Designing scripts Saves development and debugging time  Modularize! A good scripting practice is to break your script into parts (modules) this has several advantages Reusability: you can reuse one part in several scripts Easier to read: try to keep your script to one page or less

10 Designing scripts  Paper Your best defense against buggy scripts is to write it in English before you begin scripting This helps because it forces you to think out your script rather than just using the script-debug method For now don’t worry about modeling your language after what FileMaker can do instead just write and then code, you’ll learn what FM can do

11 How to define scripts  Defining scripts is easy Most of your time will be spent making sure it works as intended Don’t rely on your users to debug your scripts for you, do your own testing first  OK on to the first step: Pull down the Script menu.

12 How to define scripts  Then choose scriptmaker  The following screen will appear:

13 How to define scripts  You will notice all the buttons are dim except include in menu is checked If the include in menu button is checked the user will be able to access your script directly from the menu this provides a convenient alternative to buttons Be careful though because you have no idea where the user is when they select this  Type the name of your script and the create button will become available  Click Create

14 How to define scripts  You will be presented with this screen:

15 How to define scripts The left hand column describes all the script commands The right hand side lists the current script steps You can double click or click once and hit move to move from the commands to your script Many of the script steps are self explanatory, for those that aren’t you can check help topic “script steps” or the FileMaker Pro Bible for a better explanation

16 How to define scripts  When your done editing your script hit ok to save it.  To use it define a button and choose the perform script option  That’s it, Now we’ll go to the fun stuff: making it do something useful

17 Templates  Templates: Go to layout and do something (I.e. print, sort etc.) Go to find screen, find record(s) and display Cool Extras: using custom messages to create a print preview button

18 Templates  Making a script that goes to a layout and does something to the records before displaying This is one of the easiest scripts to write, but it is also one of the ones you will use the most It can be used to show a sorted list or go to a print screen to print Usually used with a button

19 Templates To do this you should have two helper scripts One uses the “go to layout” script The other does whatever you want to do after you are at the layout (I.e. sort or print) Finally, define one script that calls both of these scripts If you always start a database by making go to layout scripts for all your layouts this becomes even easier

20 Templates Can anyone tell me why we would want to separate these steps even though it would only be one or two lines per script? Reusability  Find script This is most often used in combination with a special find screen, the steps are: Enter find mode

21 Templates  Go to layout “find screen”  Pause the script so the user can type in the find criteria  On the find screen will be a Find and (optional)Cancel button  If Cancel is allowed and clicked this will exit the current script and run a special cancel script that finds all and goes back to the previous screen  If find is clicked the script will proceed  The find will be performed  Finally a layout will be shown One important thing to note is that the user should not be allowed to cancel this script, so add the Allow User Abort as the first option in your script and choose false as its option

22 Templates Also this is a simplified version of this script, later we will look at a better (but not as simple) version of this script with conditional statements(“if”)  We can also use user input to make decisions within a script. This requires using conditional statements which you’re not required to know yet, but it is in the lab for you to try

23 Templates In this script we can have the database prompt the user when they click on the print button it will say “Print” and also “Print Preview” If print is clicked we can use the same print script from above If print preview is clicked we can take the user to a print preview and pause before printing (this should be a separate script) To accomplish this we need the show message script step and also a way of telling which button was pressed We do this by having an “if” statement which checks this and then takes the appropriate action from above this will be explained in more detail in a later lecture.

24 The end? This lecture was just meant to be a first exposure to scripting. Scripting will be gone over in much greater detail in a later lecture. Try the lab and read the help concerning scripting steps, most importantly have fun with it. Scripting is my favorite part of working with FMPro. You’ll see why in our second Scripting lecture (week after next)


Download ppt "Lecture 4 Basic Scripting. Administrative  Files on the website will be posted in pdf for compatibility  Website is now mirrored at:"

Similar presentations


Ads by Google