Articles Archive
Director Forums
Director Wiki
Job Board
Search
 
Lingo Programming :  Director Online Forums
Questions about Lingo programming at all Levels 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
Interupting a series of sychronous operations
Posted by: Dave C (---.asm.bellsouth.net)
Date: June 23, 2010 09:17AM

I have written a small app that allows the user to queue up a list of small text files to be transferred to one or more servers. It uses Valentin Schmidt's shell Xtra, a parent script that he authored and the Putty SCP utility (pscp.exe).

I am fairly happy with the results, but there is one issue I was hoping someone might have a suggestion on how I might better handle. When the file copy is command issued, Director becomes unresponsive until the operation either succeeds (~ 6 seconds) or times out (~ 20 seconds). I believe this is due to the "synchronous" nature of the Xtra. Hey it's free and it works so I am OK with that.

The user might have elected to transfer only one file or possibly many more. 100 files is not out of the question. My program only performs one transfer per exit frame event so as not to lock it up in a large repeat loop. While these transfers are occuring, I have reduced the frame rate to 1 per second.

I have also included a Cancel button that allows the user to cancel any transfers that have not yet occured. With the frame rate setting this appears to give the user approximately a 1 second window between transfers to cancel the pending operations. Clicking the cancel button during a transfer does nothing, because as I mentioned Director is unresponsive during this time.

I am looking for a more robust means for the user to cancel the pending operations without the user having to catch the program in that 1 second window of opportunity. I suppose I could prompt the user for each transfer, but the idea is to allow them to send out a batch of updates in the most automated way possible.

The issue is most evident if the user tries to transfer files when they do not have the correct network connectivity. With a 20 second timeout for each transaction x 100...well that is a long time to wait.



Edited 1 time(s). Last edit at 06/23/2010 09:20AM by Dave C.



Re: Interupting a series of sychronous operations
Posted by: Dave C (---.asm.bellsouth.net)
Date: June 23, 2010 09:36AM

Well no sooner did I post this when I came up with a solution that helps, but I am still interested in other ideas.

I changed my Cancel button to do it's thing on mouseDown, instead of mouseUp. Now the user can click and hold the button down until the current operation is complete, at which time Director acknowledged the mouseDown event and cancels the pending operations.



Re: Interupting a series of sychronous operations
Posted by: Chunick (209.171.51.---)
Date: June 23, 2010 10:52AM

have you tried using shell_cmd_thread()?

Here's what the readme file states:
Like shell_cmd(), but as an asynchronous call, the lingo interpreter continues immediately with the next line of lingo.

This should stop any lockup.



Re: Interupting a series of sychronous operations
Posted by: Dave C (---.asm.bellsouth.net)
Date: June 23, 2010 01:13PM

Thanks Josh...you have definitely put me on the right track!

I realize now that the SCP demo I downloaded used an old version of the Shell xtra. It doesn't have a shell_cmd_thread method, but it had one called shell_cmd_asynch which I suspect was the same thing.

Anyway I think I will try to get it to work with the latest version using the shell_cmd_thread function as you suggested. I am not 100% sure how to use it, but I think the demo file will help me to figure it out. If I have any questions I'll post again.

Again, thanks.





Sorry, only registered users may post in this forum.
This forum powered by Phorum.