Page 1 of 1
urlProgress during the download of a .zip archive solved
Posted: Sat Oct 27, 2012 7:17 pm
by jmburnod
Hi All,
I use urlProgress during the download of a .zip archive like this
Code: Select all
on urlProgress tPathZipS, pStatus
if the environment = "mobile" then
put pStatus && the ticks into fld "fCommentInstall"
if pStatus is "downloaded" then
wait 1000 milliseconds
listZipContents
end if
end if
end urlProgress
It seem "lisZipContent" is sent before the download of the zip is finished
I have this error message
zipperr.Not a zip archiverevzipOpenarchive
revZipEnumerateItems
zipperr.Not a zip archiverevzipOpenarchive
What i'm wrong ?
I use LC 5.02 xCode 4.2.1
Thank in advance for your help
Best
Jean-Marc
Re: urlProgress during the download of a .zip archive
Posted: Sun Oct 28, 2012 7:44 pm
by jmburnod
Hi All,
I forgot to specify in my first post that the listZipContent message work well if i send it from a btn. I must wait "a moment".
I also tried
Code: Select all
send "listZipContent" to me in 1000 milliseconds
With the same result:
zipperr.Not a zip archiverevzipOpenarchive
revZipEnumerateItems
zipperr.Not a zip archiverevzipOpenarchiv
Do someone have a way to solving this mistake ?
Thanks
Jean-Marc
Re: urlProgress during the download of a .zip archive
Posted: Mon Oct 29, 2012 4:18 pm
by Simon
Hi Jean-Marc,
Since noone else has replied I'll give it a shot.
One thing to make sure of is that your zip file is compressed using "normal". They have different levels with names like "maximum" and "ultra". I think only "normal" is supported.
Simon
Re: urlProgress during the download of a .zip archive
Posted: Mon Oct 29, 2012 5:07 pm
by Mark
Hi Jean-Marc,
There's a good chance that your problem is solved if you write
Code: Select all
wait 1000 milliseconds with mesages
and probably you don't need to wait a full second. 200 millisecs should be enough.
Kind regards,
Mark
Re: urlProgress during the download of a .zip archive
Posted: Tue Oct 30, 2012 2:09 am
by jmburnod
hi mark,
Tanks a lot.I just return from abroad. I'll test it tomorrow.
Kind regards
Jean-Marc
Re: urlProgress during the download of a .zip archive
Posted: Tue Oct 30, 2012 11:04 am
by jmburnod
Hi Mark
One big progress with your help
I always have the same error but it don't stop the script like before. I'll do a simplified stack to catch the lizard's head
Kind regards
Jean-Marc
Re: urlProgress during the download of a .zip archive
Posted: Tue Oct 30, 2012 11:07 am
by Mark
Hi Jean-Marc,
What's the error and how was the script stopped before?
Mark
Re: urlProgress during the download of a .zip archive
Posted: Tue Oct 30, 2012 7:53 pm
by jmburnod
Hi Mark
It repeat this error message two times, then it bypass the next and work fine for revZipEnumerateItems and revZipExtractItemToFile with a custom progressbar.
zipper.Can't open file.No Such file or directoryrevZipOpenArchive
revZipEnumerateItems
zipperr.Not a zip archiverevzipOpenarchive
The mistake
An "answer dialog" which I use to signify to the user that the installation is ended makes mistake
If it is removed it, the script works fine like that:
1. listZipContents
2. revZipExtractItemToFile with a custom progressbar
3. delete file (myArchive.zip)
All files are copied where it is expected and the zip file is deleted
Kind regards
Jean-Marc
Re: urlProgress during the download of a .zip archive
Posted: Thu Nov 15, 2012 8:39 pm
by jmburnod
Hi All,
I read in the doc:
Code: Select all
on urlProgress pUrl, pStatus
if pStatus is "downloaded" then
answer "Finished downloading" with "Okay"
end if
end urlProgress
But a "Downloaded" message is sent before the end of the download.
In this case it is necessary to ignore the first "downloaded" message.
The stack in attachment download a zip archive (50 images, 1.4 Mo) in the document folder and delete it after an answer dialog.
You can see the result in the field "fSpy"
Best regards
Jean-marc
Re: urlProgress during the download of a .zip archive
Posted: Mon Nov 19, 2012 12:57 am
by Mark
Hi Jean-Marc,
I tested this and tried to find a solution that doesn't involve a hack. I can't find a reasonable solution and believe this problem should be reported as a bug.
Apparently, you could use the load URL command with a callback message. Perhaps this would be a good alternative.
Kind regards,
Mark
Re: urlProgress during the download of a .zip archive
Posted: Mon Nov 19, 2012 5:47 am
by jacque
The first "downloaded" message is from your "testConnect" handler. The second one is from the file download. If there is a urlProgress handler, it will capture all download activity. If you comment out the testConnect handler, you will only see one "downloaded" message.
Remove the sNumdownloaded counter and watch the log field. You will see the server is contacted, a short download occurs (the test url connection) and completes ("downoaded" is logged,) and then the server is contacted a second time for the longer file download.
Re: urlProgress during the download of a .zip archive
Posted: Mon Nov 19, 2012 10:21 am
by jmburnod
Hi Jacque and Mark,
Thanks
Fortunately, there is not a bug. Jacque is right, my "testconnect" handler send a "downloaded" message.
Kind regards
Jean-Marc