Hi Michael,
As Jesse has already pointed out, the FM API includes all the code you
need to do this, it's just a bit of a hard read until you get your
head around it.
I have published an example of calling the FM Do_Script, which is a
slightly modified version of what is in the FM example.
http://fmplugins.idma.co.nz/index.php/Other_TipsFor the idle stuff, just look in the main file. Near the bottom, you
will find the function
static void Do_PluginIdle(FMX_IdleLevel idleLevel)
You will only want to use the case kFMXT_UserIdle: case. And if you
are doing something intensive (like file tasks) I suggest you only use
every 60 calls (approx 1 second) or even less frequent. ie. given
the task could take several seconds, I'm sure it won't matter if you
only poll every 5 seconds.
Checking that the file is 'complete' will be the challenge. You may
need to poll for several seconds, and only assume complete if the
file size hasn't changed for several seconds ???
cheers,
Kent.
On Nov 6, 2008, at 4:34 AM, Michael Wood wrote:
> Hi Jesse
>
> On Wed, Nov 5, 2008 at 5:18 PM, jbarnum <
[hidden email]> wrote:
>> Probably the best way to handle this is by calling a script on the
>> idle
>> handler. FileMaker will
>> call your plugin frequently (about 60 times a second in my
>> testing), and
>> once your plugin
>> detects that the scan has finished, it can trigger a script the
>> next time it
>> gets called by the
>> idle handler.
>
> Thanks! That sounds like it should work very well. I haven't played
> around with FM plugins much, but I do vaguely remember something about
> the idle handler. Do you just basically specify in the resources that
> one of your functions is your idle handler?
>
>> If your plugin polls for the scanned document every second, be
>> sure to make
>> sure that the document has been closed by the app that created it,
>> so that
>> you're not
>> working with a partial document.
>
> Yes, I'll have to make sure of that :)
>
>> The script you call in FileMaker can obviously do whatever you
>> want; it can
>> insert a
>> referenced container field or it can upload the doc to
>> SuperContainer user
>> the SC plugin. It
>> is also possible to use the evaluate() function directly from your
>> plugin to
>> call other plugin
>> functions, like the SC upload, without needing to call a script in
>> FileMaker.
>
> Excellent! Another newbie question: How does one call a FileMaker
> script from the FileMaker plugin?
>
>> It's safe to call
>> plugin functions this way, but be careful about trying to access
>> field data
>> in the idle
>> hander, it doesn't work reliably.
>
> OK, thanks for the warning.
>
> --
> Michael Wood <
[hidden email]>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>