360Works RemoteScripter/Documentation

From 360Works Product Documentation Wiki
(Difference between revisions)
Jump to: navigation, search
m (Auto-upload documentation)
m (Auto-upload documentation)
 
(3 intermediate revisions by one user not shown)
Line 2: Line 2:
 
RemoteScripter allows you to remotely trigger FileMaker scripts on another computer. It can be triggered either by RemoteScripter running on a different
 
RemoteScripter allows you to remotely trigger FileMaker scripts on another computer. It can be triggered either by RemoteScripter running on a different
 
computer, or by an HTTP URL. This plugin can safely be triggered from within the Web Publishing Engine, which makes it an ideal way to trigger non-web-safe
 
computer, or by an HTTP URL. This plugin can safely be triggered from within the Web Publishing Engine, which makes it an ideal way to trigger non-web-safe
scripts on a separate script processing computer. For example, let's say that your Instant Web Publishing (IWP) application needs to be able to generate
+
scripts on a separate script processing computer. For example, let's say that your WebDirect or IWP application needs to be able to generate
 
downloadable PDF's. You would define a script called "Generate PDF" which is designed to be run on a computer running regular FileMaker Pro at
 
downloadable PDF's. You would define a script called "Generate PDF" which is designed to be run on a computer running regular FileMaker Pro at
 
IP address 10.0.0.25. It might looking something like this:</p>
 
IP address 10.0.0.25. It might looking something like this:</p>
Line 18: Line 18:
  
 
This tells RemoteScripter to trigger the Generate PDF script if it receives any requests on port 4546.</p>
 
This tells RemoteScripter to trigger the Generate PDF script if it receives any requests on port 4546.</p>
On the computer running IWP, you would have a button that the user clicks on to see the PDF. This button triggers a script which would look something
+
On the computer running WebDirect, you would have a button that the user clicks on to see the PDF. This button triggers a script which would look something
 
like this:</p>
 
like this:</p>
  
Line 27: Line 27:
 
  end if
 
  end if
  
You could also trigger the PDF generation script directly from a user's browser, without going through the IWP web server. Just have a URL that looks like this:</p>
+
You could also trigger the PDF generation script directly from a user's browser, without going through the web server. Just have a URL that looks like this:</p>
  
 
  &lt;a href="10.0.0.25:4645?35"&gt;View customer record 35&lt;/a&gt;
 
  &lt;a href="10.0.0.25:4645?35"&gt;View customer record 35&lt;/a&gt;
Line 48: Line 48:
 
=Function Summary=
 
=Function Summary=
 
<div id="toc">
 
<div id="toc">
*[[#RemoteScripterBringFilemakerToFront|RemoteScripterBringFilemakerToFront]] &mdash; You may optionally call this function to bring Filemaker to the front and give it focus.
+
*[[#RemoteScripterBringFilemakerToFront|RemoteScripterBringFilemakerToFront]] (  ) &mdash; You may optionally call this function to bring Filemaker to the front and give it focus.
*[[#RemoteScripterGetVersion|RemoteScripterGetVersion]] &mdash; Returns the version number of the RemoteScripter  plugin.
+
*[[#RemoteScripterGetVersion|RemoteScripterGetVersion]] (  ) &mdash; Returns the version number of the RemoteScripter  plugin.
*[[#RemoteScripterLastError|RemoteScripterLastError]] &mdash; Returns detailed information about the last error generated by this plugin.
+
*[[#RemoteScripterLastError|RemoteScripterLastError]] (  ) &mdash; Returns detailed information about the last error generated by this plugin.
*[[#RemoteScripterLicenseInfo|RemoteScripterLicenseInfo]] &mdash;
+
*[[#RemoteScripterLicenseInfo|RemoteScripterLicenseInfo]] (  ) &mdash;  
*[[#RemoteScripterRegister|RemoteScripterRegister]] ( licenseKey; companyName ) &mdash; Registers the plugin.
+
*[[#RemoteScripterSetErrorCapture|RemoteScripterSetErrorCapture]] ( errorCapture ) &mdash;
+
*[[#RemoteScripterSetResponseHeaders|RemoteScripterSetResponseHeaders]] ( header1 = value1 {; header2 = value2 ; ... ) &mdash; Allows the user to set the response headers and value pairs for a script by defining them in a string array.
+
*[[#RemoteScripterSetResponseHTTPcode|RemoteScripterSetResponseHTTPcode]] ( HTTPcode ) &mdash; Allows the user to set the response HTTP code for a script by defining them in an integer.
+
 
*[[#RemoteScripterSetResult|RemoteScripterSetResult]] ( resultText ) &mdash; You may optionally call this function with text to return as the result of triggered script.
 
*[[#RemoteScripterSetResult|RemoteScripterSetResult]] ( resultText ) &mdash; You may optionally call this function with text to return as the result of triggered script.
*[[#RemoteScripterStart|RemoteScripterStart]] ( portNumber; filename; scriptname { key1=value1 ; key2=value2 ; ... } ) &mdash; Starts FileMaker listening on the specified port.
 
 
*[[#RemoteScripterStop|RemoteScripterStop]] ( portNumber ) &mdash; Stops listening on this port.
 
*[[#RemoteScripterStop|RemoteScripterStop]] ( portNumber ) &mdash; Stops listening on this port.
 
*[[#RemoteScripterTrigger|RemoteScripterTrigger]] ( remoteAddress; portNumber {; parameterText ; timeout } ) &mdash; Triggers a script on the remote computer running the RemoteScripter plugin.
 
*[[#RemoteScripterTrigger|RemoteScripterTrigger]] ( remoteAddress; portNumber {; parameterText ; timeout } ) &mdash; Triggers a script on the remote computer running the RemoteScripter plugin.
Line 63: Line 58:
 
=Function Detail=
 
=Function Detail=
 
<div id="RemoteScripterBringFilemakerToFront"></div>
 
<div id="RemoteScripterBringFilemakerToFront"></div>
==RemoteScripterBringFilemakerToFront==
+
==RemoteScripterBringFilemakerToFront (  ) ==
 
You may optionally call this function to bring Filemaker to the front and give it focus.
 
You may optionally call this function to bring Filemaker to the front and give it focus.
  
Line 70: Line 65:
  
 
<div id="RemoteScripterGetVersion"></div>
 
<div id="RemoteScripterGetVersion"></div>
==RemoteScripterGetVersion==
+
==RemoteScripterGetVersion (  ) ==
 
Returns the version number of the RemoteScripter  plugin.
 
Returns the version number of the RemoteScripter  plugin.
  
Line 77: Line 72:
  
 
<div id="RemoteScripterLastError"></div>
 
<div id="RemoteScripterLastError"></div>
==RemoteScripterLastError==
+
==RemoteScripterLastError (  ) ==
 
Returns detailed information about the last error generated by this plugin. If another plugin function returns the
 
Returns detailed information about the last error generated by this plugin. If another plugin function returns the
 
text "ERROR", call this function to get a user-presentable description of what went wrong.
 
text "ERROR", call this function to get a user-presentable description of what went wrong.
Line 85: Line 80:
  
 
<div id="RemoteScripterLicenseInfo"></div>
 
<div id="RemoteScripterLicenseInfo"></div>
==RemoteScripterLicenseInfo==
+
==RemoteScripterLicenseInfo (  ) ==
  
  
  
 
<div id="RemoteScripterRegister"></div>
 
==RemoteScripterRegister ( licenseKey; companyName ) ==
 
Registers the plugin.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl></dl></div>
 
 
 
<div id="RemoteScripterSetErrorCapture"></div>
 
==RemoteScripterSetErrorCapture ( errorCapture ) ==
 
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl></dl></div>
 
 
 
<div id="RemoteScripterSetResponseHeaders"></div>
 
==RemoteScripterSetResponseHeaders ( header1 = value1 {; header2 = value2 ; ...  ) ==
 
Allows the user to set the response headers and value pairs for a script by defining them in a string array.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>headers</code> <dd>String Array that specifies the headers and value pairs in a string array
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> returns success value when the response header is set
 
</div>
 
 
<div id="RemoteScripterSetResponseHTTPcode"></div>
 
==RemoteScripterSetResponseHTTPcode ( HTTPcode ) ==
 
Allows the user to set the response HTTP code for a script by defining them in an integer.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>HTTPcode</code> <dd>integer that specifies the HTTP code that is to be set
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> success value when the the response code is set
 
</div>
 
  
 
<div id="RemoteScripterSetResult"></div>
 
<div id="RemoteScripterSetResult"></div>
Line 134: Line 93:
 
<dl></dl></div>
 
<dl></dl></div>
  
 
<div id="RemoteScripterStart"></div>
 
==RemoteScripterStart ( portNumber; filename; scriptname { key1=value1 ; key2=value2 ; ... } ) ==
 
Starts FileMaker listening on the specified port. When it gets any request on that port, it will trigger the script.
 
If there are any parameters included in the HTTP request, it will pass these along as script parameters to FileMaker.
 
 
The following starts RemoteScripter listening on port 9876. Incoming requests will trigger the <code>Remote Scripter Callback Script</code> script, passing in form values as key=value pairs, with the keys containing a <code>$foo_</code> prefix.
 
 
RemoteScripterStart( 9876; Get(FileName); "Remote Scripter Callback Script" ; "variablePrefix=$foo_")
 
 
<h3>Handling form data in FileMaker</h3>
 
If the RemoteScripter URL contains key=value data pairs, RemoteScripter will convert the values to the format <code>$key1="value1";$key2="value2"</code>.  This makes it easy to pass the resulting string to the <code>evaluate</code> and <code>let</code> functions in FileMaker, which will populate local variables with the values from the form.
 
 
For example, an HTML form with inputs for <code>firstName</code>, <code>lastName</code>, and <code>notes</code> will result in the following script parameter being passed in from RemoteScripter:
 
 
$notes="testing&para;one&para;two&para;three";$firstName="Sam";$lastName="Barnum"
 
 
To convert this to actual variables in FileMaker, use the following functions:
 
 
Evaluate ( "Let ( [" & Get(ScriptParameter) & "] ; true )" )
 
 
After calling this, you'll have local variables for <code>$firstName</code>, <code>$lastName</code>, and <code>$notes</code>.
 
<h3>Optional parameters</h3>
 
<dl>
 
<dt>variablePrefix
 
<dd>The symbol to use before a variable name, default is &quot;<code>$</code>&quot;, to facilitate the use of <code>Let</code> and <code>Evaluate</code>. For backwards compatibility with older versions of RemoteScripter (1.6 and earlier), pass an empty string for the <code>variablePrefix</code>.  To prevent form values from conflicting with predefined variables, use a unique prefix for the variable name.
 
</dl>
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>portNumber</code> <dd>the port number you wish to use for listening for events
 
<dt><code>filename</code> <dd>The name of the filemaker database containing the script.
 
<dt><code>scriptname</code> <dd>the name of the script which generates PDFs
 
<dt><code>options</code> <dd>any optional <code>key</code>=<code>value</code> parameters.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> A status message showing whether the call was successful.
 
</div>
 
  
 
<div id="RemoteScripterStop"></div>
 
<div id="RemoteScripterStop"></div>

Latest revision as of 03:57, 7 June 2017

Contents

[edit] 360Works RemoteScripter User Guide

RemoteScripter allows you to remotely trigger FileMaker scripts on another computer. It can be triggered either by RemoteScripter running on a different computer, or by an HTTP URL. This plugin can safely be triggered from within the Web Publishing Engine, which makes it an ideal way to trigger non-web-safe scripts on a separate script processing computer. For example, let's say that your WebDirect or IWP application needs to be able to generate downloadable PDF's. You would define a script called "Generate PDF" which is designed to be run on a computer running regular FileMaker Pro at IP address 10.0.0.25. It might looking something like this:</p>

Enter find mode
Set field Customer::customer ID to Get(ScriptParameter)
Perform find
Save as PDF
RemoteScripterSetResult("Success")

Now pick a random port number to run RemoteScripter on. We'll pick 4546, but it can be anything that does not conflict with another service running on the same port. You would have a startup script which calls:</p>

RemoteScripterStart(4546, Get(FileName), "Generate PDF")

This tells RemoteScripter to trigger the Generate PDF script if it receives any requests on port 4546.</p> On the computer running WebDirect, you would have a button that the user clicks on to see the PDF. This button triggers a script which would look something like this:</p>

if( RemoteScripterTrigger("10.0.0.25", 4645, Customer::customer ID) = "Success" )
	Go to Layout (Download PDF)
else
	Go to Layout (Show PDF generation error)
end if

You could also trigger the PDF generation script directly from a user's browser, without going through the web server. Just have a URL that looks like this:</p>

<a href="10.0.0.25:4645?35">View customer record 35</a>

This will trigger RemoteScripter to run the script and return whatever is set with RemoteScripterSetResult().</p>

You can use RemoteScripter to trigger scripts on your clients machines when they click links in a web viewer in your filemaker database. This allows you to design an interface in HTML, Java, Flash, or any language which can be displayed in your web viewer and then still trigger filemaker scripting. You can accomplish this by installing the Remote Scripter plugin on each of your client machines. You can then call the RemoteScripterStart function like in the example above (a startup script is a good place for this) and trigger the script using a link in your HTML to http://localhost:4645. The "localhost" url always points to the machine accessing it, so your users will trigger your script on their own machines when they click the link!</p>


[edit] 360Works Plugin Setup Guides

See Plugins_101 for Error reporting, installation, registration, and more.

[edit] Function Summary

[edit] Function Detail

[edit] RemoteScripterBringFilemakerToFront ( )

You may optionally call this function to bring Filemaker to the front and give it focus.

Returns: the location of the Filemaker executable called

[edit] RemoteScripterGetVersion ( )

Returns the version number of the RemoteScripter plugin.

Returns: a text version number

[edit] RemoteScripterLastError ( )

Returns detailed information about the last error generated by this plugin. If another plugin function returns the text "ERROR", call this function to get a user-presentable description of what went wrong.

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

[edit] RemoteScripterLicenseInfo ( )

[edit] RemoteScripterSetResult ( resultText )

You may optionally call this function with text to return as the result of triggered script. If you do not call it, it will return nothing. This is usually called near the end of the triggered script.

Parameters:


[edit] RemoteScripterStop ( portNumber )

Stops listening on this port.

Parameters:


[edit] RemoteScripterTrigger ( remoteAddress; portNumber {; parameterText ; timeout } )

Triggers a script on the remote computer running the RemoteScripter plugin. This waits until the remote computer finishes the script, and returns the result.

Parameters:

remoteAddress
the hostname or IP address of the machine whose FileMaker instance is running the plugin.
portNumber
this should be the same port number which was passed to {@link #RemoteScripterStart} by the remote computer.
paramText
Any arbitrary text to be included as a script parameter. It can be in the form of a single parameter (ie. "John"), or as multiple URL encoded parameters (ie. "firstname=John&lastname=Smith").
timeout
Number value in milliseconds.

Returns: the response from the remote computer is returned, if it calls {@link #RemoteScripterSetResult}.
Personal tools
Namespaces

Variants
Actions
Plug-in Products
Other Products
Navigation
Toolbox