Weird script behaviour (was libUrlDownloadToFile & urlProgress)
gerry.orkin at gmail.com
Wed Mar 23 05:41:48 EDT 2011
This is the script that calls the handler:
set the blendLevel of me to "10"
This is the handler that it calls (I've xxxx'd out some domain details):
local songsOnDevice, songListOnServer
hide button "stopButton"
put "Checking for updates..." into field "messages"
put url "https://xxxxxxxxxxxx.com/hrabisms/songsupdate.txt" into
put the dgText of group "Songs" into songsOnDevice
if the number of lines in songListOnServer > the number of lines in
put "Update received!" into field "messages"
set the dgText of group "Songs" to songListOnServer
set the defaultFolder to specialFolderPath("Documents")
put songsOnServer into URL ("file:songs.txt")
put "No update received. Rats." into field "messages"
put "" into field "messages"
As I said previously, this script is not executed if it's in the card
script, but does when it's in the stack script. That's weird enough,
but if I place it in the card script and I use "Send updateSongsList
to this card" in the button script it starts executing the card script
from the top, and I can track that by setting a breakpoint against the
send command - it jumps from the button script into the card script,
and I can step through all the lines in that card script, executing
them as I go.
Like I said, totally crazy!
-- photo site: http://gerryorkin.com
On Wednesday, 23 March 2011 at 4:40 PM, J. Landman Gay wrote:
> On 3/22/11 8:38 PM, Gerry Orkin wrote:
> > Jacqueline,
> > As I mentioned, it goes crazy. Setting a breakpoint in the referring
> > button script jumps me to the top line of the card script, but not to
> > the handler being called. The trace shows that LiveCode is attempting
> > to evaluate every line of code in the card script, starting from the
> > top, and including blank lines.
> Are you using the "send" command instead of just calling handlers
> directly? Those won't break unless you put a breakpoint into the handler
> you're sending to. But in general you shouldn't need to use "send" for
> most things. Too many "send" commands in a row can set up a chain
> reaction and pending messages will run out of control.
> I've never heard of a problem like this, so it's hard to diagnose. If
> you post the part of your script where it goes off track maybe we'll see
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode