In many cases, scripts that you've been using in your databases will continue to work perfectly when you access them on the Web. But when one doesn't, the user gets no feedbackthe script simply fails to do anything, or stops executing steps partway through. These issues can lead to countless phone calls and emails from frustrated users, many of whom will think that they have done something wrong.
Most incompatibilities and problems can be avoided by using the simple tools that FileMaker has provided in ScriptMaker's interface. They give you immediate status feedback, and provide script steps to end run some of the worst problems. For example, some scripts won't run because the users don't have enough privileges to delete records. In other cases, some script steps are not compatible with the Web (see the sidebar "Unsupported Script Steps" for more information).
Because this solution temporarily sidesteps your privilege sets, check all steps in your script first to be sure that none of them will allow a less-privileged user to inadvertently make unacceptable changes.
1 .
Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). In the Define Scripts dialog box, highlight a script you want to use in IWP that contains an access-dependent step, then click Edit.
2 .
When the Edit Script dialog box appears, check the "Run script with full access privileges" check box (Figure 17.28). Click OK twice to finish.
Even users with limited access privileges will be able to execute this script, without them having the same privilege outside the script.
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). In the Define Scripts dialog box, highlight a script you want to use in IWP, then click Edit.
2 .When the Edit Script dialog box appears, check the "Indicate web compatibility" box (Figure 17.29).
Any steps that are not Web compatible will now appear grayed out in the step list (Figure 17.30).
In some cases, the incompatible steps are critical, so the script should not be used on the Web. But other times, the incompatible script function is similar to printing, which can be handled another way or skipped.
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). In the Define Scripts dialog box, highlight a script, then click Edit.
2 .
When the Edit Script dialog box appears, highlight the step before the first step you want to skip. In the script list on the left, click Allow User Abort (Figure 17.31).
When Allow User Abort is off, script steps not supported on the Web are skipped, and the script continues.
3 .
Highlight the last incompatible script step. In the script list, click Allow User Abort again. In Script Step Options, click the On radio button. Click OK twice to finish.
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). In the Define Scripts dialog box, highlight a script, then click Edit.
2 .
When the Edit Script dialog box appears, highlight the step before the first incompatible step. In the script step list on the left, double-click If (Figure 17.32).
3 .In Script Step Options, click Specify. When the Specify Calculation dialog box appears, double-click PatternCount in the functions list (Figure 17.33).
4 .
In the formula box, highlight "text." In the View drop-down list, select Get functions.
5 .Scroll down to Get(ApplicationVersion) in the function list and double-click to select it (Figure 17.34).
6 .In the formula box, highlight "searchString." In the Operators section, click the "" button. Type Web between the quotes (Figure 17.35). Click OK.
7 .In the script step list, highlight the Web-compatible steps you still want to use in the alternate version. Click Duplicate (Figure 17.36).
8 .Move the duplicated steps up between the If and End If statements.
Since your Web users won't be able to print as they could in the local FileMaker application, you might need to add a step for them alone, so they can see and print the records using the browser.
9 .Scroll down to the Windows section of the script step list and select View As. In the Script Step Options, select View as List from the Specify drop-down list (Figure 17.37). Click OK twice to finish.
When users access the Weekly Report script in the application, their records will sort and print as usual. When they access the script in IWP, their records will sort and display as a scrolling list in their browser.
If you have scripts that allow the user to make changes in the database over the Web, you need to add the Commit Record/Request step to the script to make sure the changes are transferred to the database.
Most ScriptMaker steps are supported when you use them in a Web-hosted database. Those that aren't supported call for actions that can't be duplicated inside a browser, like opening new database windows, printing to a remote printer, or importing and exporting.
The unsupported steps are listed here, by category:
NavigationEnter Preview Mode
EditingPerform Find/Replace
FieldsInsert from Index
Insert Picture
Insert QuickTime
Insert File
Export Field Contents
RecordsImport Records
Export Records
Found Sets
Found Sets
WindowsAdjust Window
Move/Resize Window
Arrange All Windows
Freeze Window
Refresh Window
Scroll Window
Show/Hide Text Ruler
Set Zoom Level
FilesNo Files steps work in IWP.
SpellingOpen Menu ItemNo Spelling or Open Menu Item steps work in IWP.
MiscellaneousShow Custom Dialog
Allow Toolbars
Beep
Speak
Dial Phone
Send Mail
Perform AppleScript
Execute SQL
Send Event
Flash Cache to Disk
Be careful not to use a step that appears in this list. If you do, your script will stop running as soon as FileMaker reaches the unsupported step. Check the "Indicate web compatibility" check box in the Edit Script dialog box, and these unsupported steps will be grayed out, making it easier to avoid them.
A few ScriptMaker steps function in both the database and in IWP, but have limitations or act slightly differently on the Web. Those with limitations are:
Perform Script. All files used in the script must be open or the script will fail.
Sort. No restored sorts, unless the sort criteria is saved in the script itself.
Go to Field. Simply going to a field doesn't make the field editable in IWP.
Scripts that run, but do different things in IWP are:
Exit Application. Closes the open database and returns the user to the IWP home page.
Allow User Abort. When set to Off, the script skips unsupported steps; when On, an unsupported step ends the script.
Set Error Capture. By default, always on in IWP so users can't abort a script.
Pause/Resume Script. The user must select Resume or the script will time out.
Open URL. Since the browser is already open, this step just opens a new browser window for the new address.
Commit Record/Request. Submits changes made in IWP to the database.