start-async-task doesn't return a value, it just schedules a task and keeps on going - the task runs later.
In general, it's best to start a task immediately in response to a button press or menu selection..., and do everything within that task. - then you don't have to start them anywhere else, unless you need them as true parallel processes, like background tasks.
To keep multiple tasks from starting due to asyncronous events, use some form of recursion guarding.
Click (sound of light bulb turning on)
Thank you Rob. That got me over that learning curve and expanded my possibilities. Now I'm able to loop through the files and get what I want. I had to expand the startAsyncTask to cover more of my code for it to work they way I expected.
Note, consider post-async-task-with-context, instead of start-async-task.
The difference is that you can use the context to define error handling, so errors that occur aren't deep 6'd when it's in response to button press, as example.
More info and elare plugin framework here: https://www.assembla.com/spaces/lrdevplugin/
PS - source code there is out of date - http://www.robcole.com/Rob/ContactMe for fresh stuff.