Skip to content
dansmith65 edited this page Jul 4, 2011 · 2 revisions

oosm_AllErrors ()

Return a comma delimited list of all errors this plug-in can return.

Results

  • comma-delimited list of errors

oosm_AllErrorsToCSV (filePath)

Save to CSV file, a list of all errors this plug-in can return. Will over-rite the file if it already exists.

Parameters

  • filePath

Results

  • 1 if no error occurred

Errors

  • 104 Cannot write to file
  • 105 Cannot delete file

oosm_DirectoryCreate (path)

Create a folder

Parameters

  • path
    path to directory

Results

  • 1 if no error occurred

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 103 Directory already exists
  • 104 Cannot write to file

oosm_DirectoryDelete (path)

Delete a directory and all files/directories it contains. CAUTION: permanently deleted: NOT sent to trash

Parameters

  • path
    path to directory

Results

  • 1 if no error occurred

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 101 Directory does not exist
  • 2.05 Invalid parameter: must be a directory
  • 105 Cannot delete file

oosm_DirectoryDeleteContents (path)

Delete all files/directories contained in specified directory. CAUTION: permenantly deleted: NOT sent to trash

Parameters

  • path
    path to directory

Results

  • 1 if no error occurred

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 101 Directory does not exist
  • 2.05 Invalid parameter: must be a directory
  • 105 Cannot delete file

oosm_DirectoryDesktop ()

Return path to desktop

Results

  • Path to desktop

oosm_DirectoryList (path, options)

List contents of a directory.

Parameters

  • path
    path to directory
  • options
    Options to configure how this function will operate. Accepts the following options formatted as a value list of option=value pairs. The default values are shown.
            fullpath=false                boolean. Whether or not to return full paths.
            type=all                all, file, or directory. Limit the list to a specific type.
            regex=                regular expression. If specified, only file/directory names that match this expression will be returned.
                                    uses Java style pattern: http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
    regex examples/hints:
            - everything to the right of: (?i) will be case insensitive
            - to find all pdf files, use this string: ^(?i).*.pdf$

Results

  • list of file/directory names

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 101 Directory does not exist
  • 2.05 Invalid parameter: must be a directory
  • 2.06 Invalid parameter: option

oosm_DirectoryOpen (path)

Open folder

Parameters

  • path
    path to directory

Results

  • 1 if no error occurred

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 101 Directory does not exist
  • 3 Operation not supported

oosm_ExportContainer (containerFieldAsText, path, options)

Save container field contents to file. Useful for server-side script where you cannot use "Export Field Contents" script step. Will create directory, if it does not exist.

Parameters

  • containerFieldAsText
    container field name; use GetFieldName() function, rather than passing field name as hard-coded text
  • path
    Folder to save file to. If includes a file extension, will be saved as specified file name. If ends with a period, the file extension will be taken from the original file. Otherwise, will assume this parameter is a directory, and will append the original file name to it.
    If directory does not exist, it will be created.
  • options
    Options to configure how this function will operate. Accepts the following options formatted as a value list of option=value pairs. The default values are shown.
            overwrite=false        Whether or not to replace existing file with exported file, if a file with the same name already exists.

Results

  • 1 if no error occurred

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 103 Directory already exists
  • 104 Cannot write to file
  • 102 File already exists
  • 300 Container field is empty
  • 300.01 Could not get data from container (make sure container field name is passed as text)

oosm_FileDelete (path)

Delete a file or directory (if Directory is empty). CAUTION: permanently deleted: NOT sent to trash

Parameters

  • path
    path to file

Results

  • 1 if no error occurred

Errors

  • 2.02 Invalid parameter: could not be converted to a path
  • 100 File does not exist
  • 105 Cannot delete file

oosm_FileExists (path)

Test if file or directory exists.

Parameters

  • path
    path to file or directory

Results

  • 1 if file exists
  • 0 if file does not exist

oosm_LastError ()

Returns a semi-detailed text description of the last error. When oosm_LastErrorNumber and oosm_LastErrorShortText return -1/Unknown error, this function may have a more detailed error. All other 'LastError' functions will reset the value returned by this function. If, for example, an error occurs, then oosm_LastErrorNumber is called, then this function is called, this function will return an empty string, because no error occurred when oosm_LastErrorNumber was called.

Results

  • text description of last error

oosm_LastErrorDebug ()

Returns a detailed explaination of the last error. This will not always be set when an error occurs.

Results

  • detailed error information for last error

oosm_LastErrorNumber ()

Returns the error number as set by the last plug-in function. Refer to oosm_LastErrorShortText function, or error code table for information on the meaning of the error. Can also refer to the oosm_AllErrors function(s) to get a list of error numbers and their text descriptions.

Results

  • last error number

oosm_LastErrorShortText ()

Returns an error that is suitable to be shown to the end-user.

Results

  • short/user-friendly description of last error

oosm_PathAsDirectory (path)

Return the path of the directory in the parameter. (removes the file name portion of the path)

Parameters

  • path
    path to file or directory

Results

  • path to a directory, with trailing separator

Errors

  • 2.02 Invalid parameter: could not be converted to a path

oosm_PathAsFile (path)

Return the file name of the path in the parameter.

Parameters

  • path
    path to file

Results

  • file name, if parameter was a path to a file
  • empty string, if parameter was a path to a directory

Errors

  • 2.02 Invalid parameter: could not be converted to a path

oosm_PathAsURI (path)

Return path as a URI, so it can be used in FileMaker path dialogs.

Parameters

  • path
    path to file or directory

Results

  • path formatted as a URI

Errors

  • 2.02 Invalid parameter: could not be converted to a path

oosm_PathIsDirectory (path)

Is NOT a valid/existing file OR Is a valid/existing directory OR ends with a path separator (OS dependant) OR last segment of path does not contain a period

Parameters

  • path
    path to file or directory

Results

  • 1 if path is a directory
  • 0 if path is not a directory

Errors

  • 2.02 Invalid parameter: could not be converted to a path

oosm_PathIsFile (path)

Is a valid/existing file OR Is NOT a valid/existing directory OR does NOT end with a path separator OR last segment of path contains a period

Parameters

  • path
    path to file or directory

Results

  • 1 if path is a file
  • 0 if path is not a file

Errors

  • 2.02 Invalid parameter: could not be converted to a path

oosm_Register ()

Register a generated plug-in.

oosm_ScriptCronAdd (scriptName, parameter, schedule, options)

Add/modify a task in the cron scheduler.

Parameters

  • scriptName
    name of script to run
  • parameter
    script parameter
  • schedule
    UNIX crontab-like pattern.
    View this website for more details: http://www.sauronsoftware.it/projects/cron4j/manual.php#p02
  • options
    Options to configure how this function will operate. Accepts the following options formatted as a value list of option=value pairs. The default values are shown.
            file=(current file)        name of file to perform script in
            name=(file::name)        name of task. if the name already exists, it will be replaced
            priority=(value set by ScriptCronPrioritySet, or default)        priority for this task
            autostart=true        automatically start the cron scheduler after adding this task

Results

  • task name

Errors

  • 2 Invalid parameter

oosm_ScriptCronDelete (taskName)

Delete a scheduled task by name.

Parameters

  • taskName
    name of task, as returned by either oosm_ScriptCronAdd or oosm_ScriptCronList

Results

  • 1 if task was deleted

Errors

  • 2 Invalid parameter
  • 4 Invalid state

oosm_ScriptCronDeleteAll ()

Delete all scheduled tasks, then stop cron.

Results

  • 1 if no error occurred

oosm_ScriptCronIsStarted ()

Test if cron is running.

Results

  • 1 if cron is running
  • 0 if cron is NOT running

oosm_ScriptCronList ()

Get list of all scheduled tasks.

Results

  • list of scheduled tasks

oosm_ScriptCronNext (qty)

Get the next trigger times for all current schedules.

Parameters

  • qty

    of schedules to list

Results

  • list of tasks and their scheduled execution times

oosm_ScriptCronPriorityGet ()

Get current thread priority.

Results

  • current thread priority

oosm_ScriptCronPrioritySet (integer)

Set thread priority that will be used for all cron tasks that do not have a specific priority specified. Lower priority will result in a longer delay between the scheduled execution time and when the script is actually triggered. Default value is 9.

Parameters

  • integer
    in the range: 1-10

Results

  • 1 if no error occurred

oosm_ScriptCronStart ()

Start cron.

Results

  • 1 if no error occurred

oosm_ScriptCronStop ()

Stop cron, which prevents all scheduled tasks from running.

Results

  • 1 if no error occurred

oosm_ScriptCronTestSchedule (schedule, qty)

Get the trigger times for a schedule pattern. Use this to test the format of a schedule pattern.

Parameters

Results

  • list of execution times

oosm_ScriptPerform (scriptName, parameter, fileName)

Perform FileMaker script immediately.

Parameters

  • scriptName
  • parameter
  • fileName

oosm_SQL (sql, columnDelimiter, rowDelimiter)

This function requires the Professional Edition of ScriptMaster. Executes an SQL statement in FileMaker. Use "SQL..." custom functions found in Documentation.fp7 file to help build Query strings.

Parameters

  • sql
    SQL statement to execute
  • columnDelimiter
    Character to use between field(column) values. If left blank, will default to "|". Can only contain 1 character.
  • rowDelimiter
    Character to use between records(rows). If left blank, will default to "¶". Can only contain 1 character.

Results

  • result of SQL statement

Errors

  • 2 Invalid parameter
  • 1000 SQL Error

oosm_SQLArray (sql)

This function requires the Professional Edition of ScriptMaster. Executes an SQL statement in FileMaker, saving the result in the plug-in as a two-dimensional array. See other "SQLArray..." functions for retrieving this data. Use "SQL..." custom functions found in Documentation.fp7 file to help build Query strings.

Parameters

  • sql
    SQL statement to execute

Results

  • 1 if no error occurred

Errors

  • 1000 SQL Error

oosm_SQLArrayCountColumns ()

Count the fields found by the last call to SQLArray. First column is 1. Column 0 will return the last row, -1 the second to last, etc.

Results

  • number of columns

Errors

  • 1000.01 SQL Error: must call SQLArray before any other SQLArray... functions

oosm_SQLArrayCountRows ()

Count the records found by the last call to SQLArray. First row is 1. Row 0 will return the last row, -1 the second to last, etc.

Results

  • number of rows

Errors

  • 1000.01 SQL Error: must call SQLArray before any other SQLArray... functions

oosm_SQLArrayValue (columnNum, rowNum)

Retrieve value from saved array.

Parameters

  • columnNum
  • rowNum

Results

  • value at specified location in array

Errors

  • 2.04 Invalid parameter: must be an integer
  • 1000.01 SQL Error: must call SQLArray before any other SQLArray... functions
  • 1000.02 SQL Error: value not in array

oosm_TimerSplit ()

Returns the current split time (time since oosm_TimerStart was called, or this function was last called). Use to time events at multiple points.

Results

  • split time in fractions of a seconds

Errors

  • 200 TimerStart must be called first

oosm_TimerStart ()

Timer that is more accurate than FileMaker's time functions. Saves the current time in the plug-in, AND returns that same time value. Can be used with other Timer functions, or on it's own. This function does not return any particular time of day, it is only meant to find how much time has elapsed.

Results

  • arbitrary time in fractions of a seconds

oosm_TimerStop ()

Returns the time since oosm_TimerStart was called. Also deletes the saved values for TimerStart and TimerSplit (that were saved in the plug-in).

Results

  • elapsed time in fractions of a seconds

Errors

  • 200 TimerStart must be called first

oosm_Zip (fileToCompress, outputFile, options)

Zip contents of a container field, file, or entire directory.

Parameters

  • fileToCompress
    FileMaker container field name, path to file, or path to directory to compress. To rename the item in the zip file, include a tab character, then the name as you want it to appear in the zip file. If the path is a directory, then rename option will place the directory in the specified subdirectory. Examples are below
    FILE TO COMPRESS        RENAME                        NAME IN ZIP FILE
    D:\test\file.ext                                        file.ext
    D:\test\file.ext        apple.                                apple.ext
    D:\test\file.ext        apple\                                apple\file.ext
    D:\test\file.ext        apple\bannana.txt                apple\bannana.txt
    (below assumes that D:\test\ directory only has a single file.ext in it)
    D:\test\                                                file.ext
    D:\test\                apple\                                apple\file.ext
  • outputFile
    path (including file name) of zip file to create. ".zip" extension will be added if this path does not end with ".zip".
  • options
    Options to configure how this function will operate. Accepts the following options formatted as a value list of option=value pairs. The default values are shown.
            overwrite=false        overwrite outputFile
            level=6                compression level
            buffer=1024                buffer size to use when reading/writing to file

Results

  • 1 if no error occurred

Errors

  • 2 Invalid parameter
  • 100 File does not exist
  • 102 File already exists
  • 106 Cannot read file
  • 300 Container field is empty
  • 300.01 Could not get data from container (make sure container field name is passed as text)

this page was generated by Documentation.fp7 file, which is available in the downloads section

Clone this wiki locally