Put Put

Andre Garzia andre at andregarzia.com
Mon Dec 7 13:41:12 EST 2009


Dan,

this is me guessing here, but why don't you use a script local variable like

local lRunning

on doSave
 if lRunning is true then
  send "doSave" to me in 200 millisecs
 end if
 put true into lRunning
 put "ftp://admin:password@123.456.789.012/UploadTest.txt" into ftpPath
 --use a valid path
 put "This is a test" into url ftpPath
 if the result <> "" then
   put false into lRunning
   answer the result
 end if
put false into lRunning
end doSave

With such script you can be sure that no doSaves can work at the same time,
of course, you can enter a loop if doSave never returns...



On Mon, Dec 7, 2009 at 4:34 PM, Dan Friedman <dan at clearvisiontech.com>wrote:

> Hiya...
>
> Isn't the "put" command blocking?  I find that if I call a 'put' to write
> to a server twice in fast succession, the second 'put' is handled BEFORE the
> first one is complete.  For example:
>
> I made a new stack with this script:
>
> on doSave
>  put "ftp://admin:password@123.456.789.012/UploadTest.txt" into ftpPath
>  --use a valid path
>  put "This is a test" into url ftpPath
>  if the result <> "" then
>    answer the result
>  end if
> end doSave
>
> Then, I added a menu with a Command-S "Save" option with this script:
>
> on menuPick pWhich
>  switch pWhich
>  case "Save"
>    doSave
>    break
>  case "Quit"
>    --Insert script for Quit menu item here
>    break
>  end switch
> end menuPick
>
> Then, type Command-S twice - quickly.  POOF!  You get "error Previous
> request not complete".  Shouldn't the first Save complete before the second
> one is even dealt with?  What am I doing wrong?
>
> Thanks in advance,
> -Dan_______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the Use-livecode mailing list