FTP spooler, inoperable buttons and on idle handler

I am trying to write AppleScript Studio app that watches a folder for new files, queues the references to those files in a table, and FTP the files one at a time.
I added buttons to the window that contains the table that deletes jobs in the queue, bump jobs up, paused the queue etc…
The problem is that the buttons are inoperable while a file is being sent.
Heard this one before?

What’s happening is that script is waiting for the result of file transmission.
I’ve tried different approaches to work around this.
I tried using do shell script cULR -T and the FTP client Interarchy to send files and have the on idle handle check if cURL -T process is running or if Interarchy is busy.
Unlike other apps I have Apple-scripted, Interachy doesn’t have, use or support is busy.
And when I check if the process ID for cURL -T is running, during the course of a transmission, it is, then it isn’t, then it is. I think its only running while it’s actually sending packets. I dunno. I’m no FTP expert.
I ended up just getting rid of the buttons, but that’s not the solution I was hoping for.
I would like to add this functionality back to the app.
Any thoughts, ideas or advice?

Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)

Hi,

this is a general problem. AppleScript (Studio) is single-threaded, that means, you can’t perform tasks in the background unless you use a second AppleScript helper application or you Objective-C for one of the tasks.
ObjC has no restrictions to create several threads.

A third option is to redirect stdout (standard output) of the shell to dev/null. Then the code after the cURL line will be executed immediately

Thanks for the reply.

I found out the hard way that AppleScript is only a single thread - sigh.
I’v been banging my head against Obj-C, but for me, the learning curve is a little steep.

I guess I looking for some kind of work around.
Because I want the files to send one at a time, I need to know when a transmission has finished.
In it’s current state, the script is waiting for the result of the cURL -T. Hence buttons don’t work while it’s waiting.
I would like to be able to have the on idle handle check for state of the transmission, but haven’t found a way.
I was wondering if someone had an idea how I might do this. Maybe a different FTP client or have the shell command in a script that loads or something.