welcome to the bots mailing list.
I did simular things.
best way to do this is to use a customized out-communication method.
use communication type 'communicationscript'
from the source code of 'communication.py':
For running an userscript for communication.
Examples of use:
- call external communication program
- call external program that extract messages from ERP-database
- call external program that imports messages in ERP system
- communication method not available in Bots ***or use sub-classing for this***
- specialised I/O wishes; eg specific naming of output files. (eg including partner name) ***beter: use sub-classing or have more user exits***
place of communicationscript: bots/usersys/communicationscripts
name of communicationscript: same name as channel (the channelID)
in this communicationscript some functions will be called:
- connect (required)
- main (optional, 'main' should handle files one by one)
- disconnect (required)
arguments: dict 'channel' which has all channel attributes
more parameters/data for communicationscript: hard code this in communicationscript; or use bots.ini
Different ways of working:
1. for incoming files (bots receives the files):
1.1 connect puts all files in a directory, there is no 'main' function. bots can remove the files (if you use the 'remove' switch of the channel).
1.2 connect only builds the connection, 'main' is a generator that passes the messages one by one (using 'yield'). bots can remove the files (if you use the 'remove' switch of the channel).
2. for outgoing files (bots sends the files):
2.1 if there is a 'main' function: the 'main' function is called by bots after writing each file. bots can remove the files (if you use the 'remove' switch of the channel).
2.2 no 'main' function: the processing of all the files can be done in 'disconnect'. bots can remove the files (if you use the 'remove' switch of the channel).
hope this helps, or gives you ideas
On 09/14/2012 01:51 PM, Mike Marti wrote: