360Works Scribe 4.1 User Guide

Installation

Requirements

FileMaker version 12 or higher.

When 360Plugins are intialized for the first time, they will automatically download all required support files

Install Steps for FileMaker Pro

Drag the plugin from the MAC or WIN folder into your FileMaker extensions, and restart FileMaker.

If the plugin does not load correctly, please send an email to support@360works.com

WebDirect Install (FMS 13+)

Install plug-ins for use with WebDirect by dragging the appropriate plugin to FileMaker Server/Web Publishing/publishing-engine/cwpc/Plugins

Install steps for Instant Web Publishing

You do not need to do this step unless you plan on using the plugin with Instant Web Publishing with FileMaker Server Advanced. You will need an Enterprise license to use this feature.

For installing into the Web Publishing Engine with FileMaker Server or FileMaker Server Advanced, drag the plugin from the MAC or WIN(.fmx) folder into the FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins folder. If there is no Plugins folder inside the wpc folder, then create it manually. Restart FileMaker Web Publishing, and now the plugins should be ready to go.

The easiest way to test whether the plugin is working is to call the version function of the plugin, and display that on an IWP layout. If it shows "?", then the plugin is not working. If it shows a number, then the plugin has been installed successfully.

Install steps for Custom Web Publishing

If you are using FileMaker Server 12.0v1, you can follow the same procedure as detailed above for custom web publishing. However, in FileMaker Server 12.0v2 and later, custom web publishing now runs as a 64-bit application and requires the 64-bit version of the plugin You will need an Enterprise license to use this feature.

For Mac, the single plug-in file in the MAC directory contains both 32-bit and 64-bit versions. For Windows, look for the plug-in that has the extension .fmx64 and use it in exclusively in custom web publishing.

To install 64-bit plug-ins, install either the .fmx64 or the .fmplugin to the following directory:

FileMaker Server / Web Publishing / publishing-engine / cwpc / Plugins

If it does not exist, create the Plugin folder manually. Restart FileMaker Web Publishing, and then you can then test a script that contains a plug-in and see if it returns the correct values.

Install steps for server scheduled scripts

You do not need to do this step unless you plan on using the plugin with scheduled script triggering. You will need an Enterprise license to use this feature.

  1. Drag the plugin from the MAC (.fmplugin file) or WIN (.fmx64 file) folder into the FileMaker Server extensions folder. On Mac OS X, this is located at /Library/FileMaker Server/Database Server/Extensions folder. On Windows, this is at C:\Program Files\FileMaker\FileMaker Server\Database Server\Extensions.
  2. Restart the FileMaker Script Engine by opening Terminal (Mac) or CMD (Windows) and type the command: fmsadmin restart fmse -y . Note: On Windows you may need to change directories to where the fmsadmin utility is located in order to run this command. By default this is located at "C:\Program Files\FileMaker\FileMaker Server\Database Server" This step is not necessary if using Powershell
  3. Go to Configuration -> Database Server->Server Plug-ins and check the box that says 'Enable FileMaker Server to use plug-ins'(if it is not already checked), and then check the 'enabled' box for this plugin. Click the 'save' button and wait a few seconds to make sure that the 'enabled' check box stays checked. If it does not, then there was an error loading the plugin and you should contact us for help troubleshooting. You should now be able to write schedules that trigger scripts which use the plugin.

Auto Update

360Works has created an AutoUpdate helper database which makes setting up AutoUpdate much easier. This file includes pre-configured plugin files which you can place on your server, and an AutoUpdate script for each of our plugins which you can paste into your own solution.

You can get the AutoUpdate360Works file here Follow the instructions included in the file to either host your own Auto Update server or pull the files from ours.

Uninstalling the plugin

Uninstall the plugin by quitting FileMaker Pro or stopping FileMaker Server and removing the plugin file from your Extensions directory.

Demo mode and Registering the plugin

Plugins will run in demo mode until they are registered. While running in Demo mode, the product will run for 2 hours every time you launch FileMaker / FileMaker Server / FileMaker Web Publishing Engine. The 2 hour time limit will reset every time you relaunch FileMaker. There is no expiration date when Demo mode stops working. There are no feature differences between the Demo version and the licensed version.

Once you have purchased the plugin, you can register it with the license key. Once a valid license key is entered, the product will run for as long as FileMaker is running. After FileMaker starts up with the plugin installed, open FileMaker preferences, click on the Plug-ins tab, select the plugin from the list, and click the Configure button. Enter your license key and company name in this dialog. You will only need to do this once on a given machine. Alternately, you can use the registration function to register the plugin during a startup script.

Note: If you are running the plugin with FileMaker Server / FileMaker Web Publishing Engine, you must use the registration function to register the plugin, since there is no preferences dialog on FileMaker Server to enter the license key and company name. You will need to call the register function at the beginning of any script that is going to call plugin functions. This will ensure that you do not get demo mode errors.

Product Wiki

This is the main documentation for the plugin. However, we also maintain a documentation Wiki that contains additional information for a lot of our products. You can find that page here

Feedback

We love to hear your suggestions for improving our products! If you are experiencing problems with this plugin, or have a feature request, or are happy with it, we'd appreciate hearing about it. Send us a message on our website, or email us!

Error Handling/Reporting

When something unexpected happens, a plugin function returns a result of "ERROR". This makes it easy to check for errors. If a plugin function returns "ERROR", call the ScribeSetErrorCapture function to get a detailed description of what went wrong.

Here is an example of basic error reporting:

Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ]
If [ $result = "ERROR" ]
    Show Custom Dialog [ "An error occurred: " & ScribeSetErrorCapture ]
End If

Chaining Multiple Functions Together

Since the string "ERROR" evaluates to false when evaluated by FileMaker, and most plugin functions return a 1 when successful, you can chain multiple dependent plugin operations together using the "and" operator. However, in this case the result will be a 1 or a 0, not "ERROR". For example:

// chain multiple calls together
// if any of the functions fail, the calculation will
// short-circuit with a result of false,
// and none of the subsequent function calls will be evaluated.
Set Variable [ $success =
    FirstPluginFunction("x") and
    SecondPluginFunction("y") and
    ThirdPluginFunction("z")
]
If [not $success]
    Show Custom Dialog [ "An error occurred: " & ScribeSetErrorCapture ]
End If

Note: the above only works for plugin functions which return 1 on success! Check the documentation for each function used in this manner.

Additional Error Checking - Plugin not installed

If a plugin is not installed correctly, calls to a plugin function will return "?". As part of your startup script, you should check for this occurrence and display a warning accordingly that the plugin needs to be installed. Note: when treated as a boolean true/false value, FileMaker will treat ? as true.

Examples

Scribe is a multi-purpose plugin for reading and manipulating documents, and working with text. See the 'How to use Scribe.fmp12' example file for more in-depth examples. Here is a basic example on how to use Scribe to write to a Word document using placeholders Word Document template content:
 Hello CUSTOMERNAME,

 Your account, ACCOUNTNUMBER, is past due. Please pay ACCOUNTBALANCE by DUEDATE in order to continue service.

 Thank you,
 Support Team
 

Script to replace the placeholders with content from FileMaker:
 #load the document first
 ScribeDocLoad[Container Or URL: myTable::myDoc]

 #replace the placeholders in the document with information from FileMaker
 ScribeDocSubstitute[Search Text: "CUSTOMERNAME";Replace Text:Customer::Name]
 ScribeDocSubstitute[Search Text: "ACCOUNTNUMBER";Replace Text:Accounts::Number]
 ScribeDocSubstitute[Search Text: "ACCOUNTBALANCE";Replace Text:Account::Balance]
 ScribeDocSubstitute[Search Text: "DUEDATE";Replace Text:Account::Due Date]

 #Save the document to a container. You can also use ScribeDocSaveFile to save directly to the hard drive.
 ScribeDocSaveContainer[Select;Result: Customer::Correspondence;New Name:""]
 

Function Summary

Function Detail

ScribeDifferenceReport ( someText ; otherText )

Returns a report on the types of differences between two blocks of text. This will always return three return-separated values: additions, modifications, deletions. Each line consists of a label, edit count, and character count.

  ScribeDifferenceReport[Select; Some Text: "This is some text";Other Text: "This is some other text"]
 

This function will return a report like the one below :

 additions: 2 214
 modifications: 0 0
 deletions: 1 47
 

Indicates that:

Parameters:
someText - initial text
otherText - modified text
Returns: report on the number of differences between the two blocks of text.

ScribeDifferencesBetween ( someText ; otherText { ; options } )

Returns the highlighted differences between two blocks of text. Any text which is in 'otherText' but not in 'someText' is considered an addition, and is styled according to the ScribeStyleAddedText style. Any block of text which has changed from 'someText' to 'otherText' is considered modified text, and is styled according to the ScribeStyleModifiedText style. Any text which is in 'someText' but not in 'otherText' is considered a deletion, and is styled according to the ScribeStyleDeletedText style.

Custom Options

Pass "verbose=true" as a custom option to cause modifications to be displayed as a delete then an insert, instead of a modification.
 Set Field[myTable::Differences; ScribeDifferencesBetween("This is some text";"This is some other text";"verbose=true")]
 

Parameters:
someText - intial text
otherText - revised text
options - options
Returns: Styled text which displays the differences between the two strings, according to highlighting parameters.

ScribeDocAppend ( data { ; key=value } )

(Currently only for Microsoft Word) Appends data to the end of the currently loaded document (see ScribeDocLoad. This is useful if your file template does not contain text to replace, or you want to add a repeating section to a document.
 ScribeDocLoad[Container or URL: myTable::myDocument] //load the document first
 ScribeDocAppend[Data: myTable::myOtherDocument] //append another document directly after the end of the first
 Set Field[myTable::NewDoc;ScribeDocSaveContainer("new.docx")]
 

Optional arguments:

newPage=true: force a page break before the appended document


 ScribeDocLoad[Container or URL: myTable::myDocument] //load the document first
 Set Variable[$append; Value: ScribeDocAppend(myTable::myOtherDocument;"newPage=true")]
 Set Field[myTable::NewDoc;ScribeDocSaveContainer("new.docx")]
 

Parameters:
data - text or image or another document to append to the currently loaded document
Returns: 1 on success, or "ERROR" if an error occurs.

ScribeDocCancel

Closes the currently loaded document without saving any pending changes. This releases any in-memory resources or file locks used by the currently loaded document.

Returns: Always returns 1

ScribeDocListFields

Lists all fields in the loaded document. This is function is helpful when using ScribeDocReadValue or ScribeDocWriteValue to get a return-separated list of fields. You can then loop through that list to read/write to the document
 Set Variable[$fields; Value: ScribeDocListFields]
 

PDF Support

Returns any named acrofields.

Word Support (Office 2007 format or later. Works with .docx files only.)

Returns any named content control fields

Excel Support (Office 2007 format or later. Works with .xlsx files only.)

Returns a list of sheets in the excel document.

Returns: return-separated list of field names. For Excel documents, this returns the bottom-right cell coordinate.

ScribeDocLoad ( containerOrUrl { ; password=xxxxx } )

Loads a file. You must load a file before calling any of the other ScribeDoc* functions.
  ScribeDocLoad[Container or URL: Documents::myDocument]
 

Parameters:
containerOrUrl - container, path (including File URLs), or URL for the file being loaded.
args - optional arguments.
Returns: 1 if the file was successfully loaded, or an error message if the an error occurred.

ScribeDocReadValue ( name { ; key=value ; ... } )

Reads a field value from the currently loaded file. The behavior of this function depends on the type of document currently loaded (see ScribeDocLoad).

PDF Support

To read an acrofield from a PDF, pass the name of the acrofield whose value you wish to retrieve.

To read metadata values, use the respective name parameter: Note: the descriptions for the fields above are suggested by PDF standards community, but may not strictly represent the values in those fields.

Word Support (Office 2007 format or later. Works with .doc and .docx files.)

Microsoft Word supports named placeholders in word documents called Content Control Fields. Pass the tag name of the Content Control Field as the parameter. Content control fields can only be created on Office 2007 on Windows, but can be read and written on both Windows and Mac. More information about how to make content control fields can be found here.

Table Support

Read values from a specific table cell in Microsoft Word using Excel-style syntax, e.g. to read the 3rd column of the 15th row of the first table in a Word document:
     ScribeDocReadValue("Table1!C15")
 

Excel Support (Office 2007 format or later)

To read values from an excel sheet, pass the coordinates of a single cell, e.g. "A5".

To specify a sheet other than the first sheet, include the sheet name followed by an exclamation point, e.g. "Sheet 2!BB42".

New Excel Features in Scribe 2.0

To read a range of values as CSV, specify the start and end columns delimited by a colon, e.g. A1:C15. Optionally, pass "invert=true" as an additional parameter to read rows-first instead of column-first. Optionally, pass "rowSeparator=x" or "fieldSeparator=y" as additional parameter to specify custom delimiters.

ScribeDocReadValue("A1:C15" ; "fieldSeparator=|")

To get the maximum bounds of a worksheet, request MaxRow( ) or MaxCol ( ). Optionally, pass in worksheet=... as an additional parameter, for example:

ScribeDocReadValue("MaxRow()" ; "worksheet=Second Sheet" )

Note: you may pass the optional argument forceTrimTrailingNullRows=true to force scribe to ignore null rows at the end of a worksheet. Null rows sometimes exist as a result of pasting data into Excel, and may be undesirable.

To read a cell's formula (instead of the formula result), pass "formula" as an optional parameter, e.g.

Set Variable[$c3Formula; Value: ScribeDocReadValue( "C3" ; "formula" )] // SUM(A1,B1)
     

This will return the formula text, if one is specified on the cell.

To read cell comments, pass "commentText" as an optional parameter, e.g.

Set Variable[$c3Comment; Value: ScribeDocReadValue( "C3" ; "commentText" )]
     

To read cell background colors, pass "background" as an optional parameter, e.g. to read a cell value and then style some FileMaker text the same color:

Set Variable[$c3BackgroundColor; Value: ScribeDocReadValue( "C3" ; "background" )]
     # $c3BackgroundColor is a numeric color value, we can use it to style some text
     TextColor ( myTable::sampleField ; $c3BackgroundColor )
     

XML Support

To read values from an XML document, pass an XPath expression identifying the node to be modified as the first parameter.

Parameters:
name - attribute name to read.
Returns: value of the named attribute in the currently loaded file, or "ERROR" if an error occurs.

ScribeDocSaveContainer ( newName {; flatten=true ; type=file } )

Returns the currently loaded file as a container field, applying any modifications. This closes the document after saving it to a temporary folder.

The newName parameter tells Scribe what to name the container field value. This can take two forms:

The optional flatten parameter can be used with PDF forms to save a "flattened" version of the form, this would make the form fields unenterable.

The optional type parameter can be set to "file" to explicitly save a file container instead of an image.

PDF Password support (new in Scribe 2.0), pass a "password" parameter to password-protect the saved PDF. You can optionally specify separate "userPassword" and "ownerPassword" parameters.

For example, if you've done a find and replace operation on a Word document and would like to store it into a container field called 'ResultContainer' while retaining the original filename, you would do it this way:

 Set Field[ Results::ResultContainer; ScribeDocSaveContainer("") ]
 

Parameters:
Returns: A container field value which can be inserted into any container field with a Set Field script step.

ScribeDocSaveFile ( path {; flatten=true } )

Saves the currently loaded file to disk, applying any modifications. This closes the document after saving it.

The path parameter tells Scribe where to save the file to. This can take several forms:

The optional flatten parameter can be used with PDF forms to save a "flattened" version of the form, this would make the form fields unenterable.

PDF Password support (new in Scribe 2.0), pass a "password" parameter to password-protect the saved PDF. You can optionally specify separate "userPassword" and "ownerPassword" parameters.


 Set Variable[$save; Value: ScribeDocSaveFile("";"password=myPassword123")]//saves the pdf with original file name and a password
 

This can be used with the 'Insert File' script step to insert the file into a container field in FileMaker.You can also save directly to a container field using ScribeDocSaveContainer


 Set Variable[$save; Value: ScribeDocSaveFile("";"password=myPassword123")]
 Insert File[Insert;myTable::myDocument;$save]//inserts file at path in $save into myDocument container field
 

Parameters:
Returns: FileMaker file path to the saved file, for example 'file:/Macintosh HD/Users/jesse/Desktop/Letter_to_clients.docx'.

ScribeDocSubstitute ( searchText ; replaceText )

Replaces all occurrences of searchText with replaceText in the currently loaded document. Note that searchText and replaceText generally should be short pieces of text, which only span one line (for convenience... long search strings can be more complicated to correctly enter into FileMaker calculations). This feature is only available for Microsoft Word 2007 and later (.docx files only). To replace named form fields or cells in a PDF form, Word Document, or other file, use the ScribeDocWriteValue function instead. If you need to substitute many different text occurrences, just call this function once for each term that you want to find and replace. Please see the Example section at the top of this page for example usage. // *

// * Word documents support image replacement in Scribe 2.0, you can pass a container as the replaceValue, and an image will be inserted into your Word document. // *

Image Support in Microsoft Word Files

Word documents support image replacement in Scribe 2.0. Pass a container as the replaceText to add it to the Word document.

ScribeDocSubstitute("placeholderHere" ; myTable::myContainer )

To use this, you must first load a document using ScribeDocLoad.

Note: ScribeDocSubstitute does not support container data stored as reference. Containers must be stored either internally or externally.

Saving the File

After calling ScribeDocSubstitute one or more times, save the modified file using ScribeDocSaveFile.

Parameters:
searchText - text to find
replaceText - text to replace searchString with. Word documents support image replacement as well.
Returns: 1 on success, or "ERROR" if an error occurs.

ScribeDocWriteValue ( name ; value { ; key=value ; ... } )

Write a field value in the currently loaded file. The behavior of this function depends on the type of document currently loaded (see ScribeDocLoad).

To use this, you must first load a document using ScribeDocLoad.

PDF Support

To write an acrofield on a PDF, pass the name of the acrofield whose value you wish to set as the first parameter. You can also write values to checkboxes and radio buttons. The only values you can write are "Off" or "Yes", and they are case-sensitive.

To write XMP metadata to a PDF, use the PDFMetadata key, and pass in the XMP xml you wish to write (read this using ScribeDocReadValue

To write attachments to a PDF, use the PDFAttachment key, and pass in a container to attach to the file. Existing attachments with matching names will be replaced, otherwise a new attachment will be added to the PDF.

Word Support

Microsoft Word supports named placeholders in word documents (.docx files only) called Content Control Fields. Pass the tag name of the Content Control Field as the first parameter. Content control fields can only be created on Office 2007 on Windows, but can be read and written on both Windows and Mac. More information about how to make content control fields can be found here.

Alternatively, Scribe also supports using placeholders in your template to replace with text. See the ScribeDocSubstitute function for details on how to do this.

Table Support in Microsoft Word Files

Use excel-style syntax to refer to table cells in a word document. For example, to write a value to the 3rd row, 4th column of the first table in a Word document:

     ScribeDocWriteValue("Table1!D3", "This is a table cell")
 

Writing to non-existent table cells will create new rows/columns as needed, copying cell styles from preceding cells.

Image Support in Microsoft Word Files

Use ScribeDocSubstitute or ScribeDocAppend to add images to a Word document.

Excel Support

To write values to an excel sheet (.xlsx files only), pass the coordinates of a single cell, e.g. "A5" as the first parameter.

The second parameter can be text or an image in a container field. Images will be placed so the top-left corner of the image is in the cell indicated by the name parameter.

To specify a sheet other than the first sheet, include the sheet name followed by an exclamation point, e.g. "Sheet 2!BB42".

Writing a value to a non-existent sheet will generate an error. If you specify a non-existent cell or row, it will be created.

To write formulas to an Excel sheet, preface the value with an equals sign, e.g.
     ScribeDocWriteValue("C3" ; "=SUM(A1,B1)" )
 

To explicitly write a value with a leading equals sign, pass "literal" as the optional third parameter.
wrap
Set to true to wrap newlines in the written text

PowerPoint Support (new in Scribe version 2)

Write images to a PowerPoint file by specifying the sheet number and optional coordinates for the image to add to the PowerPoint presentation. For example, to add an image from a container field to the first slide:

 ScribeDocWriteValue("1"; MyTable::MyImage;"x=100";"y=200";"width=300";"height=400")
 

XML Support

To write values to an XML document, pass an XPath expression identifying the node to be modified as the first parameter.

PDF Support (in Scribe 2.0)

Use the following functions to modify a PDF:

Adding Pages to a PDF

ScribeDocWriteValue("newPage()" ; "2" )

Adding Images to a PDF

ScribeDocWriteValue("addImage()" ; my::imageContainer ;"page=2" ;"x=100" ; "y=100" ; "width=300" ;"height=400" )

Adding Text to a PDF

ScribeDocWriteValue("addText()" ; "Hello, PDF!" ;"page=2" ;  "x=200" ; "y=500" )

Saving the File

After calling ScribeDocWriteValue one or more times, save the modified file using ScribeDocSaveFile.

Note:

Due to the nature of writing directly to the document XML, calculations in Excel cells may not fire automatically when the value is written.

Parameters:
name - field / cell to write to
fmValue - data to write
Returns: 1 on success, or "ERROR" if an error occurs.

ScribeFileAsKeywords ( fileOrContainer )

Returns a unique list of keywords for the file. Unlike ScribeFileAsText, this only returns unique names, and strips out common "stop words" like "a", "and", "the", etc. This can reduce storage requirements if you are performing text searches against the contents of files, but don't need the extracted text to be human-readable.

Parameters:
file - file or container field to extract index from
See also: ScribeFileAsText
Returns: A unique list of keywords in the currently loaded document, or "ERROR" if an error occurs.

ScribeFileAsText ( fileOrContainer{; param1=value1; param2=value2} )

Returns the plain text content of the file.

For binary file document formats such as Word, PDF, etc. this attempts to return a human-readable presentation of the document. XML documents are returned as-is. Any unrecognized file will have its raw text contents returned (see optional parameters to customize this).

You can pass in optional additional parameters to customize the behavior of this function. A list of customizations follows:

Here is a list of supported file types for reading text from:

Parameters:
file - file or container field to extract text from
Returns: plain text content of the currently loaded document, or an empty string if the input is empty, or "ERROR" if an error occurs.

ScribeGetPDFAttributes ( sourcePDF )

Return some metadata about the PDF. Pass this function a source PDF to retrieve a list of attributes about the PDF.
 Set Variable [ $newPDF ; ScribeGetPDFAttributes ( myTable::myContainer ) ]
 

Parameters:
sourcePDF - The original PDF
Returns: A list of attributes for the sourcePDF, or ERROR

ScribeHighlight ( text; highlightPattern {; param1=value1 ; param2=value2 ; ...} )

Highlights all occurrences of highlightPattern in text.

Unlike the substitute function, this is case-insensitive by default. The highlightPattern function supports regular expression patterns.

Regular Expression Pattern Processing

Using the flags optional parameter, you may set the following options, each of which influences the way patterns are matched.

caseInsensitive
Enables case-insensitive matching for US-ASCII characters.
multiline
Does not match line-terminating characters. This means that when the input text is a return-separated list, each line is matched independently.
literal
Treats metacharacters like ^ and $ and escape sequences like \t as literals.
includeLineEndings
Matches line-terminating characters, which means that a return-separated list would be treated as a single text block.
ignoreWhitespace
Ignores whitespace characters.

Example

Example of a highlight operation to match the string "file://" at the beginning of each line of a return-separated list.

 Set Field [ Globals::highlighted_text =
     ScribeHighlight(
     "file://temp/doc.txt" & ¶ &
     "file://documents/doc.txt" & ¶ &
     "http://my.site.com/home" & ¶ &
     "ftp://my.ftpsite.com/upload" ;
         "^file://" ;
         "flags=multiline"
     )
 ]
     
This matches "file://temp/doc.txt" & ¶ & "file://documents/doc.txt"

Style, color and size

Highlighting style is determined by the three optional parameters: colorRGB, styles, and size. Consult the Filemaker TextStyleAdd and TextColor documentation for more details about named Filemaker text styles and colors.

Example

Example of a highlight operation to make any occurrences of "atlanta" blue and bold (the default highlight style is bold, blue text):

 Set Field [ Globals::highlighted_text =
     ScribeHighlight(Documents::body ; "atlanta")
 ]
 

Example of a highlight operation to highlight runs of 1 or more sequential numbers as green italic text:
 Set Field [ Globals::highlighted_text =
     ScribeHighlight(
         Documents::body ;
         "[0-9]+" ;
         "colorRGB=" & RGB(0;255;0) ;
         "styles=" + Italic"
     )
 ]
 

Parameters:
text - The input text
highlightPattern - the word or regular expression pattern to highlight
additionalParameters - Additional parameters are specified using a name=value syntax. The parameters colorRGB, size and styles control the look of the replaced text. The parameter flags controls the way in which pattern matching is performed.
Returns: The input text with all occurrences of highlightPattern highlighted with the current styles.

ScribeLastError

Returns the last Scribe-related error which occurred. This should be called any time that a plugin function returns "ERROR" to get a user-readable description of the error.

Returns: Error text, or "" if there was no error.

ScribeLicenseInfo

Returns information about the license used.


ScribeMergePDF ( pdf1 ; pdf2 { ; password1=x ; password2=y ; filename=merged.pdf ; binaryResult=false ... } )

Merges two PDFs into a single PDF file.

Parameters:
pdf1 - The first PDF.
pdf2 - The second PDF.
args - optional arguments such as password1, password2, binaryResult.
Returns: container data of the resulting PDF file, or the filepath to the file if binaryResult=false, or "ERROR" if an error occurs.

ScribeOCRBegin ( containerOrUrl ; awsAccessKey ; awsSecretKey ; awsRegion { ; simple=false } )

Begins an OCR operation on a PDF or image, starting a new job on AWS and returning a jobId which can be used to poll for completion using ScribeOCRFetch.

AWS Setup

Scribe OCR uses Amazon Web Services for OCR analysis. In order to use this, you must create an AWS account and set up a user access key / secret key / permissions. See supporting documentation for more details.

Pricing

Check pricing details for your region for the Detect Document Text API (OCR) service. This is typically around $0.0015 USD per page. At this rate, performing OCR on 1,000 pages will cost $1.50.

Parameters:
containerOrUrl - Image/PDF to perform OCR analysis on
awsAccessKey - The AWS Access Key of the account used to perform OCR
awsSecretKey - The AWS Secret Key of the account used to perform OCR
awsRegion - The AWS Region where OCR is performed
Returns: a jobId

ScribeOCRFetch ( jobId ; awsAccessKey ; awsSecretKey ; awsRegion { ; timeout=0 ; return=plaintext } )

After creating a jobId with ScribeOCRBegin, call this function with your jobId to return the OCR results, if they are available.

Blocking vs Non-Blocking

You can specify a timeout in seconds to wait for a job to completion. The default timeout is zero. After timeout seconds have passed and the jobId job is still not finished, the plugin will return "ERROR" and the ScribeLastError will return RESULTS_NOT_READY. You can then try fetching the results again later, or increaising the timeout value. Typically OCR operations finish in under one minute.

Optional Parameters

timeout
Number of seconds to wait for a job to complete. Defaults to 0.

Parameters:
jobId - the jobId to fetch results for
awsAccessKey - The AWS Access Key of the account used to perform OCR
awsSecretKey - The AWS Secret Key of the account used to perform OCR
awsRegion - The AWS Region where OCR is performed
Returns: The OCR data for your jobId

ScribePatternMatchAll ( text; regex {; flags=flag1+flag2+flag3+...} )

Returns a newline-delimited list containing pattern matches. Any text that is not a pattern match will be omitted.

Example of a function to extract a return-separated list of numbers from a string.

 ScribePatternMatchAll("123 and 5321 are open, but 0121 is closed" ; "[0-9]+")
 /* returns the following:
 123
 5321
 0121
 */
 

Regular Expression Pattern Processing

Using the flags optional parameter, you may set the following options, each of which influences the way patterns are matched.
caseInsensitive
Enables case-insensitive matching for US-ASCII characters.
multiline
Does not match line-terminating characters. This means that when the input text is a return-separated list, each line is matched independently.
literal
Treats metacharacters like ^ and $ and escape sequences like \t as literals.
includeLineEndings
Matches line-terminating characters, which means that a return-separated list would be treated as a single text block.
ignoreWhitespace
Ignores whitespace characters.

The default behavior of this function uses the caseInsensitive and includeLineEndings flags, so the following function calls are equivalent:

     ScribePatternMatchAll(
         "Wilhelm¶wilson¶Williams¶Zander" ;
         "wil.*" ;
         "flags=includeLineEndings+caseInsensitive"
     )
     ScribePatternMatchAll(
         "Wilhelm¶wilson¶Williams¶Zander" ;
         "wil.*"
     )
 

Parameters:
text - input text
regex - regular expression pattern.
flags - An additional parameter used to specify flags that control how pattern matching is performed. To specify multiple flags, separate each with a plus sign (e.g., ..."flags=literal+ignoreWhitespace")
Returns: Any pattern matches, separated by line breaks.

ScribePatternReplaceAll ( text; regex; replacement {; param1=value1 ; param2=value2 ; ...} )

Replace all occurrences of a regex pattern with some replacement text. The replacement text can optionally be styled.

Highlighting style is determined by the three optional parameters: colorRGB, styles, and size. Consult the FileMaker TextStyleAdd and TextColor documentation for more details about named Filemaker text styles and colors.

Backreferences can also be used with the regular expression. Replacement text can use dollar sign syntax ($1, $2, etc.) to refer to these groups.

Regular Expression Pattern Processing

Using the flags optional parameter, you may set the following options, each of which influences the way patterns are matched.

caseInsensitive
Enables case-insensitive matching for US-ASCII characters.
multiline
Does not match line-terminating characters. This means that when the input text is a return-separated list, each line is matched independently.
literal
Treats metacharacters like ^ and $ and escape sequences like \t as literals.
includeLineEndings
Matches line-terminating characters, which means that a return-separated list would be treated as a single text block.
ignoreWhitespace
Ignores whitespace characters.

Example of simple replace, converting two or more consecutive line breaks to a single line break:

 ScribePatternReplaceAll(
     "Line one¶Line Two¶¶¶Line Three¶Line Four" ;
     "\n+" ;
     "ΒΆ"
 )
 // returns "Line one¶Line Two¶Line Three¶Line Four"
 

Example of a highlighting replace operation, highlighting the literal string "quick" by using styles:

 ScribePatternReplaceAll("The quick brown fox" ;
     "quick" ;
     "quick" ;
     "colorRGB=" & RGB(128 ; 128 ; 255) ;
     "styles=" + Bold
 )
 // returns The quick brown fox
 

Parameters:
text - The input text
regex - The regular expression
replacement - The text to replace the found occurrences with
additionalParameters - Additional parameters are specified using a name=value syntax. The parameters colorRGB, size and styles control the look of the replaced text. The parameter flags controls the way in which pattern matching is performed.
See also: ScribeHighlight
Returns: The input text with all occurrences of regex replaced with replacement

ScribeRegister ( licenseKey; registeredTo )

Registers the plugin.

Parameters:
licenseKey - a valid license key
registeredTo - the company the plugin is registered to
Returns: 1 on success, or "ERROR" on failure.

ScribeReportProblem ( emailAddress ; problemDescription )

Send a problem report to 360Works. This can also be done in the configuration window in Preferences.

Parameters:
emailAddress - The user's email address to allow for support contact
problemDescription - A description of the current issue
Returns: Always returns 1

ScribeSetErrorCapture ( errorCapture )

Toggles error dialogs on or off. When something unexpected happens, the plug-in will pop up a dialog displaying the error message. This makes it easy to see what went wrong. However, in some cases, you may prefer to show your own message to the user, or possibly not show a message at all. In that case, you can call ScribeSetErrorCapture with a parameter of true. That will suppress the error dialog from appearing to the user. This is a boolean value so make sure you do not put the parameter in "". NOTE:This will only suppress error dialogs when plugin functions are called as part of a calculation. * If you are calling plugin functions as script steps ( available in FM 16+) then you will need to use the native * FileMaker function Set Error Capture On/Off
*
ScribeSetErrorCapture(True)

Parameters:
errorCapture - set to true to suppress the default popups.

ScribeSplicePDF ( pdf ; pageNumbers { ; key1=value1 ; key2=value2 ; ...} )

Extract some pages from a PDF document into a new PDF. Pass this function a source PDF and some page numbers to extract and use in the new PDF.

The pageNumbers parameter should be a comma-separated list of page numbers or page number ranges.

Optional Parameters

filename
The name given to the resulting PDF file
filepath
destination folder/path for the resulting file
ownerPassword
The password used to encrypt the PDF file
 Set Variable [ $newPDF ; ScribeSplicePDF (
     myTable::myContainer ; // sourcePDF
     "1, 10, 20-30" ;  // pageNumbers
     "filename=SplicedResult.pdf" // optional filename parameter
 ) ]
 

Parameters:
sourcePDF - The original PDF
pageNumbers - The page numbers to take from the original PDF when assembling the new PDF.
args - optional parameters
Returns: newly created PDF which contains the specified pageNumbers from the sourcePDF. Or, the filepath to the file if binaryResult=false

ScribeStyleAddedText ( color ; styles { ; open ; close } )

Sets the style to use for displaying added text. The default plugin behavior is to display added text as green.

This will affect all calls to ScribeDifferencesBetween until you quit FileMaker.

The available styles are:

Parameters:
color - a FileMaker RGB value (such as 'rgb(255,0,0)' for red) or HTML-style hex value (such as "#FF0000" for red)
styles - Any of the Filemaker style keywords, or -1 to hide text of this type in the diff result.
open - An optional text string appended before an addition
close - An optional text string appended after an addition
Returns: 1 on success, or "ERROR" on failure. Use diffLastError to get more information on the error.

ScribeStyleDeletedText ( color ; styles { ; open ; close } )

Sets the style to use for displaying deleted text. The default plugin behavior is to display deleted text as red with a strikethrough style.

This will affect all calls to ScribeDifferencesBetween until you quit FileMaker.

Parameters:
color - a FileMaker RGB value (such as 'rgb(255,0,0)' for red) or HTML-style hex value (such as "#FF0000" for red)
styles - Any of the Filemaker style keywords, or -1 to hide text of this type in the diff result.
open - An optional text string appended before a deletion
close - An optional text string appended after a deletion
Returns: 1 on success, or "ERROR" on failure. Use ScribeLastError to get more information on the error.

ScribeStyleModifiedText ( color ; styles { ; open ; close } )

Sets the style to use for displaying modified text. The default plugin behavior is to display modified text as blue.

This will affect all calls to ScribeDifferencesBetween until you quit FileMaker.

Parameters:
color - a FileMaker RGB value (such as 'rgb(255,0,0)' for red) or HTML-style hex value (such as "#FF0000" for red)
styles - Any of the Filemaker style keywords, or -1 to hide text of this type in the diff result.
open - An optional text string appended before a modification
close - An optional text string appended after a modification
Returns: 1 on success, or "ERROR" on failure. Use ScribeLastError to get more information on the error.

ScribeVersion

Returns the version of the plugin which is installed.