Procedure Recorder

Panorama’s procedure recorder is like a tape recorder that records your actions as you work. In other words, Panorama automatically writes your code for you! How easy is that? Most commands and tools that affect data can be recorded, including editing, sorting, searching, analyzing, morphing, import/export, and printing.

The recorder works in any Procedure Editor window. When you click on the recorder tool, it turns red to show that the recorder is running.

Once the recorder is running, simply go to a data sheet or form window and perform the actions you want to record. If the procedure window is active, you’ll see each line of code appear as each step is recorded. New steps are always added at the end of the procedure (even if you’ve been editing the code at some other spot).

That’s all there is to it! When you’re done, click the recorder tool again to stop the recording (it will also stop if you close the window, or if you click on the recorder tool in another procedure editor window.)

You can use the recorded code as-is, or you can modify it as necessary. You can even edit it as it is being recorded! For example, if you make a mistake, you can delete it immediately, and then continue recording. You don’t even need to stop the recorder.

You can also go back and modify code you recorded before, even re-record parts of it. For example, I could take the code I just recorded and modify it to select Pennsylvania instead of California.

The recorder isn’t limited to simple tools – even complex dialogs can be recorded.

#### Recordable Actions

Most commands and tools that affect data can be recorded. Nothing bad happens if you perform an action that isn’t recordable (for example, inserting a field), but you will see that no code appears. So you can always try an action to see if it is recordable. Here is a detailed (but not necessarily comprehensive) list of recordable actions.

- uprecord, downrecord, firstrecord, lastrecord (from tools & menus only, simply clicking on data sheet is not recordable)
- select, find, next match/previous match (including selecting based on a favorite), selectall, selectreverse, selections from the context menu
- find & replace dialog
- propagate, unpropagate, propagateup, unpropagateup
- add record, insert record, insert below record, deleterecord, deleteall, delete unselected, delete selected
- cut/copy/paste record, duplicate record
- sort (up/down), sort up within, group, group by day/week/month/quarter/year, sort dialog, summarize/analyze dialog
- total, count, average, minimum, maximum
- morph field/all fields, recalculate field, morph upper/lower case, clear field
- outline level, remove summaries, expand/collapse summaries
- hide/show fields (including dialog and favorites)
- print, print preview
- opening data sheet and forms from the View menu
- import database dialog
- exporting from File menu, including Text Export wizard (must export via Save As dialog, not by dragging)
- Import Text wizard (but only if import is from a file, does not record if importing from the clipboard or dragged text)

#### Recording Mouse Clicks

Clicking the mouse is not a recordable action. However, if you record an action where the current column position is important (for example sorting, grouping, or totalling) Panorama will add a Field statement to the recording to make sure that correct field is selected.

The recorder will ignore all other mouse clicks (for example, clicking on the scroll bar, dragging a window to a new position or changing the size of a window, etc.).

Panorama never records the row position of a click. In other words, if you click on a specific record, that is not recorded and does not become part of the code.

If you do want a Panorama procedure to move to a specific record you’ll need to use the find statement. You can either create this during recording using the Find/Select Dialog or simply by typing it into the procedure window.

    find Name="David Tito"

Panorama will record the use of the up, down, first and last tools.

#### Recording Data Entry

Panorama can record any data values entered into database fields. In this example I create a procedure that will automatically create a new record that is pre-filled for San Francisco.

Of course if I run this procedure later it will create a new San Francisco record.

#### Recording Date Values

Panorama has special handling for recording of date values, as shown in this movie.

#### Recording Text Export

The commands in the File>Export menu are recordable. In this example, a procedure is recorded that sorts up by zip code and then does a comma-delimited export to the desktop.

For more complex exports you can record the Text Export Wizard. If you do this, you must complete the process by saving the export to a file with the Choose File dialog (dragging the text to the another application is not recordable).

Here’s a closer look at the recorded code. You can repeat this export at any time by running this procedure — without opening the Text Export Wizard again.

Aren’t you glad you didn’t have to write that code yourself?

#### Recording Text Import

The Text Import wizard is also recordable, with one restriction — you must import from a file. It does not record if importing from the clipboard or dragged text (because it has no way of re-creating the clipboard contents or dragged text when the procedure is run later). Here’s an example of code recorded by the Import Text wizard.

#### Adding Undo to Recorded Code

Most operations in Panorama can be undone, but by default, procedures you write aren’t Undo-able, whether you write them manually or record them (or both). For most procedures, however, adding undo support simply requires adding one line of code to the top of the procedure — startdatabasechange. For a typical recorded procedure that sorts, selects, or otherwise modifies more than one record in the database, you’ll want to use the `"allrecords"` option to tell Panorama that Undo needs to restore all records in the database. Here’s an example that takes the first recording shown above and adds the ability to Undo.

    startdatabasechange "allrecords","Cities in California"
    field "City"
    sortup
    select State match "CA"

When you run this procedure, then look in the Edit menu, you’ll see that you can Undo the effects of this procedure.

In the example above, the code manually specified the title that will appear in the Edit menu. You can use the info(“procedurename”) function to automatically specify that the name of the procedure be used. This way, even if the procedure is renamed, the Edit menu will have the correct title in the Undo item.

    startdatabasechange "allrecords",info("procedurename")

If the procedure does nothing but change data in the current record, use `"currentrecord"` with the startdatabasechange statement, like this:

    startdatabasechange "currentrecord",info("procedurename")
    City = "San Francisco"
    State = "CA"

But don’t use this option if more than one record is changed. Even if you just add a record and then modify it, that requires the use of the `"allrecords"` option.

    startdatabasechange "allrecords",info("procedurename")
    addrecord
    City = "San Francisco"
    State = "CA"

To learn more about this topic, see the startdatabasechange statement.

See Also

- Accessing the Clipboard -- reading from and writing to the system's clipboard.
- Action Menu -- simple way to create your own menu items.
- Alerts -- displaying a variety of standard modal alerts.
- Automatic Field Code -- running a short program when data is entered into a field.
- Channels -- provide a standard way to interface with external resources (email servers, phones, web sites etc.)
- Code -- basics of programming code.
- Coding with Debug Instrumentation -- modifying your code to generate debug instrumentation output.
- Control Flow -- making decisions about what code should be executed in response to changing conditions.
- copyindentedcode -- copies the selected code with 4 space indent (for pasting into the Panorama forum).
- Crash Proof Debug Instrumentation Monitoring -- real time crash-proof instrumentation monitoring
- Custom Dialogs -- creating custom dialogs using forms.
- Custom Menus -- creating custom menus, menu bars and pop-up menus (and customizing standard menus).
- Custom Statements -- creating your own custom statements that can be used in your code.
- Customizing Debug Instrumentation Coverage -- specifying what code is being debugged at the moment.
- Database Navigation & Editing -- using program code to navigate within a database, and to add and remove database records.
- Debug Instrumentation -- conditional logging of the internal state of Panorama program code.
- Debug Instrumentation Log Window -- dynamically monitor debug instrumentation output as your program runs.
- Debug Instrumentation Monitoring using an External Program -- monitoring debug instrumentation with an external program (Terminal.app, BBEdit.app).
- Debug Instrumentation Text File -- configuring and accessing the debug instrumentation log (text) file.
- Drag and Drop -- dragging data to and from a Panorama form.
- Generating & Analyzing HTML -- generating HTML code from data, and extracting data from structured HTML.
- Internet Access -- accessing information from web servers.
- Procedure Editor -- editing named procedures.
- Procedures -- basics of procedures for automation.
- Program Access to Databases -- using a program to create, open, import or export databases.
- Program Error Handling -- handling errors and exceptions that occur when a program is running.
- Programmable Database Administration -- using a program to access and/or modify the structure of a database.
- Programmable Form Management -- using a program to work with forms.
- Programmable Graphics -- using program code to create and modify graphic objects in a form.
- Programmable Outlines -- using a program to create and manipulate data outlines.
- Programmable Printing -- using program code to print reports, mailing labels, etc.
- Programmable Searching -- using program code to search and select data.
- Programmable Sorting -- using program code to sort a database.
- Programmable Text Export -- using a program to export text from a database.
- Programmable Window Management -- using a program to arrange windows.
- Programming Database Fields -- using a program to add and remove database fields.
- Recompiling Code -- recompiling code & formulas
- Recording Code Triggers in Debug Instrumentation -- the code triggers option automatically tracks whenever any code is triggered, whether from a menu, a button, or implicitly (for example when data is entered).
- Recording Control Flow in Debug Instrumentation -- configure debug instrumentation to automatically log when control flow is non-linear, for example a call, return, goto, etc.
- Scripting -- embedding scripting languages (AppleScript, shell scripts, Python, Ruby, PHP, Perl, etc.) into Panorama program code.
- Speech Programming -- using program code to convert data to speech (voice).
- Statements -- index of all statements available for use in Panorama procedures.
- Subroutines -- writing code that can be called from other code.
- Suppressing Display -- temporarily disabling display of changes in a program (to reduce "flickering" and increase performance).
- Timer Workshop -- provides a tool for monitoring timers and testing timer configurations.
- Timers -- executing recurring periodic background code at fixed intervals.
- Transforming Data -- using program code to modify data in bulk.
- Triggers -- finding out what event triggered the execution of program code.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but with a new user interface.