Unzip file and show it.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Unzip file and show it.
Ok I renamed my pdf file as imagesApp and removed the .pdf extention and zipped it and then uploaded it to my server and also renamed a folder full of non decompressed pdf's as imagesApp and uploaded them to my web server one at a time.
I used the following code below exactly as presented in this thread and executed it from a button in the simulator. The imagesApp.zip file does get downloaded to the documents folder however it does not de compress and delete itself. I tried both the individual file and the folder.
Here is the code
on mouseup
downloadFiles
unZip
end mouseup
on downloadFiles
libUrlDownloadToFile "http://myservername.on-rev.com/Maps/magesApp.zip", specialfolderpath ("documents") & "/imagesApp.zip"
send unZip to me in 0 milliseconds
end downloadFiles
command unZip
put specialFolderPath("documents") & "/imagesApp.zip" into TempFile
put specialFolderPath("documents") & "/" into TargetFile
revZipOpenArchive TempFile, "read"
put RevZipEnumerateItems(TempFile) into tList
repeat for each line i in tList
if i = empty then
next repeat
end if
revZipExtractItemToFile TempFile, i, (TargetFile & i)
end repeat
revZipCloseArchive TempFile
delete file TempFile
end unZip
I use the code below to confirm that the zip file did get downloaded and that the compression did not take place with the code below
I use the code
on mouseUp
if the environment is mobile then
put specialFolderPath("documents") into tpath
set the defaultfolder to tpath -- so you can get the folder names
put the folders into tMyList -- get a list of folder names
put the files into tList -- a list of the file names
answer tList -- returns imagesApp.zip
answer tMyList -- returns one unrelated folder name that I have copied over on openstack
end if
end mouseUp
So what do you think? NOTE: the file i am trying to decompress is a .pdf file and the folder I would like to decompress is a folder holding non individually compressed pdf's and I have zipped the folder itself. I cant seem to decompress anything.
dave
I used the following code below exactly as presented in this thread and executed it from a button in the simulator. The imagesApp.zip file does get downloaded to the documents folder however it does not de compress and delete itself. I tried both the individual file and the folder.
Here is the code
on mouseup
downloadFiles
unZip
end mouseup
on downloadFiles
libUrlDownloadToFile "http://myservername.on-rev.com/Maps/magesApp.zip", specialfolderpath ("documents") & "/imagesApp.zip"
send unZip to me in 0 milliseconds
end downloadFiles
command unZip
put specialFolderPath("documents") & "/imagesApp.zip" into TempFile
put specialFolderPath("documents") & "/" into TargetFile
revZipOpenArchive TempFile, "read"
put RevZipEnumerateItems(TempFile) into tList
repeat for each line i in tList
if i = empty then
next repeat
end if
revZipExtractItemToFile TempFile, i, (TargetFile & i)
end repeat
revZipCloseArchive TempFile
delete file TempFile
end unZip
I use the code below to confirm that the zip file did get downloaded and that the compression did not take place with the code below
I use the code
on mouseUp
if the environment is mobile then
put specialFolderPath("documents") into tpath
set the defaultfolder to tpath -- so you can get the folder names
put the folders into tMyList -- get a list of folder names
put the files into tList -- a list of the file names
answer tList -- returns imagesApp.zip
answer tMyList -- returns one unrelated folder name that I have copied over on openstack
end if
end mouseUp
So what do you think? NOTE: the file i am trying to decompress is a .pdf file and the folder I would like to decompress is a folder holding non individually compressed pdf's and I have zipped the folder itself. I cant seem to decompress anything.
dave
Re: Unzip file and show it.
Hi Dave,
I didn't mean you had to remove the .pdf extensions
I'll tell you what Chris had a problem with, the zip file had a folder name in it so it created a sub directory in the destination folder.
on revZipExtractItemToFile TempFile, i, (TargetFile & i) "i" contained /New folder/extacted.pdf so looking for the file at TargetFile came up empty.
To figure out what it was he added a fld and put tList into it. Take a look.
Simon
I didn't mean you had to remove the .pdf extensions

I'll tell you what Chris had a problem with, the zip file had a folder name in it so it created a sub directory in the destination folder.
on revZipExtractItemToFile TempFile, i, (TargetFile & i) "i" contained /New folder/extacted.pdf so looking for the file at TargetFile came up empty.
To figure out what it was he added a fld and put tList into it. Take a look.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Unzip file and show it.
My script is not executing that far down.
command unZip
put specialFolderPath("documents") & "/imagesApp.zip" into TempFile
put specialFolderPath("documents") & "/" into TargetFile
answer "made it this far" -- this line of code executes
revZipOpenArchive TempFile, "read"
answer "made it this far too" -- this line of code never executes so figure must be an issue with revZipOpenArchive
However I know there is an imagesApp.zip in the documents folder because this code says there is...
on mouseUp
if the environment is mobile then
put specialFolderPath("documents") into tpath
set the defaultfolder to tpath -- so you can get the folder names
put the files into tList -- a list of the file names
answer tList
end if
end mouseUp
command unZip
put specialFolderPath("documents") & "/imagesApp.zip" into TempFile
put specialFolderPath("documents") & "/" into TargetFile
answer "made it this far" -- this line of code executes
revZipOpenArchive TempFile, "read"
answer "made it this far too" -- this line of code never executes so figure must be an issue with revZipOpenArchive
However I know there is an imagesApp.zip in the documents folder because this code says there is...
on mouseUp
if the environment is mobile then
put specialFolderPath("documents") into tpath
set the defaultfolder to tpath -- so you can get the folder names
put the files into tList -- a list of the file names
answer tList
end if
end mouseUp
Re: Unzip file and show it.
Just a quick check.
Do you have revzip selected in your standalone settings?
Simon
Do you have revzip selected in your standalone settings?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Unzip file and show it.
SO I rebuilt the stack and selected the rev zip inclusion in the general settings of the standalone builder.
I am still not getting the script to execute the line
revZipOpenArchive TempFile, "read"
as the
answer "I made it this far too" line never executes just below it. It freezes up I guess.
However an empty folder is now being created in the documents folder called "theContent" go figure?
Dave
I am still not getting the script to execute the line
revZipOpenArchive TempFile, "read"
as the
answer "I made it this far too" line never executes just below it. It freezes up I guess.
However an empty folder is now being created in the documents folder called "theContent" go figure?
Dave
Re: Unzip file and show it.
Hi Dave,
Built a stack for you to look at. I think the trouble is revZipExtractItemToFile will not create folders.
Check out the scripts in both buttons, one downloads just zipped files the other a zipped folder.
Important to look at tList as you will see the first line is a folder.
Simon
Built a stack for you to look at. I think the trouble is revZipExtractItemToFile will not create folders.
Check out the scripts in both buttons, one downloads just zipped files the other a zipped folder.
Important to look at tList as you will see the first line is a folder.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Unzip file and show it.
Rats!
Just tested it on Win and it wasn't as reliable: I've added a downloadComplete message to the end of the libUrlDownloadToFile.
Much more robust.
Simon
Just tested it on Win and it wasn't as reliable: I've added a downloadComplete message to the end of the libUrlDownloadToFile.
Much more robust.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Unzip file and show it.
Thanks Simon,
I downloaded your stacks and they seem to work fine. I will carefully substitute my zipped file paths from my server into the script and give it a test run and report back tonight.
Thanks!
Dave
I downloaded your stacks and they seem to work fine. I will carefully substitute my zipped file paths from my server into the script and give it a test run and report back tonight.
Thanks!
Dave
Re: Unzip file and show it.
Works great ! I built a progress bar to show the download time and the folder unzipping is very fast.
Thanks again!
Dave
Thanks again!
Dave
Re: Unzip file and show it.
Hmmm...?
Does the unzip process still work in the example stack above? I downloaded it, did not make any changes, made sure the RevZip external was selected in the standalone settings, but when I test in simulator the zipped files do not unzip. The file gets downloaded, test.zip and testfolder.zip as they are listed, though they are not unzipped and deleted...
I have been futzing with the unzip process today and never was successful. Wondering if it's broke?
Thank you!
Does the unzip process still work in the example stack above? I downloaded it, did not make any changes, made sure the RevZip external was selected in the standalone settings, but when I test in simulator the zipped files do not unzip. The file gets downloaded, test.zip and testfolder.zip as they are listed, though they are not unzipped and deleted...
I have been futzing with the unzip process today and never was successful. Wondering if it's broke?
Thank you!
Re: Unzip file and show it.
Hi jpatten,
Which version of liveCode are you using?
Oh... and system stuff.
Simon
Which version of liveCode are you using?
Oh... and system stuff.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Unzip file and show it.
Simon...
I'm running the latest version of LiveCode 6.1.3 and Version 6.0 (369.2) of the OS X simulator, OSX 10.9.
Thanks for taking a look!
I'm running the latest version of LiveCode 6.1.3 and Version 6.0 (369.2) of the OS X simulator, OSX 10.9.
Thanks for taking a look!
Re: Unzip file and show it.
Hi jpatten,
It appears that the callbackMessage is no longer being sent on mobile.
For a temp workaround you can re-enable that send in on downloadFiles
I wouldn't use that method when releasing a product but you can use it for testing.
summary:
libUrlDownloadToFile does not send callbackMessage on mobile.
Simon
It appears that the callbackMessage is no longer being sent on mobile.
For a temp workaround you can re-enable that send in on downloadFiles
Code: Select all
send unZip to me in 50 milliseconds
summary:
libUrlDownloadToFile does not send callbackMessage on mobile.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!