Script essentials

This section describes the essential information you'll need to create your own scripts.

This example Python script takes a server name, call name, and a set of string arguments on the command line and prints the result of the call.


import sys
import xmlrpclib

   proxy = xmlrpclib.ServerProxy("http://" + host + ":1801/");
   token = proxy.user.login('<aiw-system-userid>','<aiw-system-user-password>')
   proxy = xmlrpclib.ServerProxy("http://" + host + ":1801/?credential=" + token);
   print getattr(proxy,sys.argv[2])(*sys.argv[3:])

except xmlrpclib.Fault, err:
   print err.faultString + " (" + str(err.faultCode) + ")"

These lines of code will be an essential part of any script you develop with Connect.

List methods

A script that uses the coding shown above, named xcall in this example, can run System.listMethods to return a list of methods on a particular system. You can then use those methods to interact with the system. You can make the list more readable by piping the result to the tr command to translate the commas to new lines.

For example:

xcall remotesys System.listMethods | tr ',' '\n'

Note: remotesys is a machine on your Ricoh ProcessDirector network that is accessible using port 1801.

The listed methods will vary depending on the extensions that are installed, Here is a small sampling of methods that are returned.


Method signature

You can use System.methodSignature to get the signatures of the TrackingGroup.get method. (TrackingGroup.get is part of the Document Tracking extension.)

xcall remotesys System.methodSignature TrackingGroup.get

This call returns a tuple:

[['array', 'array'], ['array', 'array', 'string', 'string'], ['array'], ['string', 'string'], ['string', 'array', 'struct'], ['array', 'array', 'string']]

This tuple is a collection of arrays where the first index of each array is the return type, and the remaining values in the array are the parameters.

For this array:

['array', 'array']

An array is returned, and an array is the parameter.

For this array:

['array', 'array', 'string', 'string']

An array is returned, an array is the first parameter, and strings are the second and third parameters.

Example: Getting job properties

You can get all job data on the remotesys system—current jobs on the system and all associated job properties—with:

xcall remotesys Job.get

Copyright © 2014, 2018