Adapting Scripts for Web Users
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.
To allow users to run scripts with full access
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.
Figure 17.28. A user with limited rights won't be able to run this script unless the script runs with full privileges.
[View full size image]

To see if a script is Web compatible
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).
Figure 17.29. Scripts display as usual until you specifically request a Web-compatibility check.
[View full size image]

Figure 17.30. Although you can still select them, incompatible scripts are displayed in gray type.

To skip incompatible script steps
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).
Figure 17.31. Turning off the Allow User Abort step skips subsequent IWP-incompatible steps.

To create IWP alternative steps in a script
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).
Figure 17.32. The If step allows you to set two conditions: when the script runs on the Web and when it runs as usual.

Figure 17.33. The PatternCount function compares text strings looking for a match between them.

Figure 17.34. Get(ApplicationVersion) returns different information for Web users than it does for regular users.
[View full size image]

Figure 17.35. Anyone using IWP to access the FileMaker database will broadcast "Web" to the Get function.

Figure 17.36. Duplicate the compatible steps to avoid having to re-create them.
[View full size image]

Figure 17.37. On the Web, View as List provides a scrolling list of records in the found set that can be printed through the Web browser.

Unsupported Script Steps
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 ModeEditingPerform Find/ReplaceFieldsInsert from IndexInsert PictureInsert QuickTimeInsert FileExport Field ContentsRecordsImport RecordsExport RecordsFound SetsFound SetsWindowsAdjust WindowMove/Resize WindowArrange All WindowsFreeze WindowRefresh WindowScroll WindowShow/Hide Text RulerSet Zoom LevelFilesNo Files steps work in IWP.SpellingOpen Menu ItemNo Spelling or Open Menu Item steps work in IWP.MiscellaneousShow Custom DialogAllow ToolbarsBeepSpeakDial PhoneSend MailPerform AppleScriptExecute SQLSend EventFlash Cache to DiskBe 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.