Page 1 of 1
problems with revZipOpenArchive
Posted: Fri Feb 04, 2011 6:09 pm
by magice
I am writing a comic reader app. The comic files are basically just a zipped group of jpgs. So I am playing around with the revZip commands/functions. Unfortunately they are making me feel like a complete idiot because I can't seem to get them to work. Here is the experimental code i wrote:
Code: Select all
on mouseUp
answer file "Load Comic"
if it = "" or the result <> "" then
exit mouseUp
else
put it into theFile
revZipOpenArchive theFile, "read"
put revZipEnumerateItems(theFile) into tComicArray
split tComicArray by cr
put tComicArray[1] into tImageName
revZipExtractItemToFile theFile, "tImageName" , "openimage.jpg"
set the paint of image viewArea to "openimage.jpg"
revZipCloseArchive theFile
end if
end mouseUp
What I thought it would do, is ask for the file location, use that data to open the archive, put a list of the archived images into an array, extract the first image in the array to a jpg and then set my image area to that jpg. What i get is nothing after the file input. if I add a "Answer tComicArray" after revZipEnunerateItems command it returns nothing. This suggests to me that either I did not open the archive properly or I did not retrieve the list properly. Any help would be appreciated.
Re: problems with revZipOpenArchive
Posted: Sat Feb 05, 2011 11:51 pm
by magice
Well, from the lack of response, I guess I am not the only person who is unable to get the revZip commands/functions to work. At least I know now it's not me.
Re: problems with revZipOpenArchive
Posted: Sun Feb 06, 2011 5:49 am
by doc
Hey magice,
I've never even looked at the Zip library and will be of no help at this point... hang tight, someone that knows what's going on will be by before ya know it. (weekend stuff has everyone's attention right now, I'm guessing)
In the meanwhile, I'll have a look to see if I can be of assistance.
-Doc-
Re: problems with revZipOpenArchive
Posted: Sun Jan 06, 2013 3:42 am
by ThatOneGuy
I am having the same problem with my code. I can get it to load the zip file in the IDE, but it freezes up when I try to use revZipOpenArchive in standalone. All messages, including "quit", are locked since it never passes revZipOpenArchive. My app just stops working completely, much in the same way yours has.
Of course, I am trying to do something a bit more complicated since I need to pull out all items (including sub-folders) of a windows ".app" archive (basically a recompiled program that is zipped with a .app extension), read an "AppInfo" file contained therein, and launch the app that I just loaded. As I said, it works in IDE (I have a nice .app archive that runs in windows much like a .exe), but not in standalone. If you can't get it working in IDE, I may be of some assistance. If you are at the same point that I am, I cannot help you.
I have already discussed this problem with a few people, but even with their suggestions I cannot get the revZip.dll library to load in standalone with my program, but it does work with the revZipper sample project and I have used that one to un-archive my .app files in standalone, so I know it can work. Apparently it's just picky as to which program it loads in. Someone needs to figure this out soon since there's likely to be many people with the same problem.
Re: problems with revZipOpenArchive
Posted: Sun Jan 06, 2013 5:35 am
by jacque
magice, check the syntax of the line where you are setting the image content. The content of an image is the "text" of the image (I know, it's odd.) What's happening now is that the script will create a custom property named "paint" in the image object, which isn't what you want. Also, you can't just pass a file name, you need to tell the engine that it should read in the contents of the file. The easiest way to do that is to use the URL syntax:
set the text of image "viewArea" to url ("binfile:openimage.jpg")
Always quote the names of objects, btw. But remove the quotes from "tImageName" in the revZip call. It's a variable, not a literal, so shouldn't have quotes.
I don't trust how you're referencing the file path, it's fragile. But for now, your file will be located in the current defaultfolder.
Re: problems with revZipOpenArchive
Posted: Sun Jan 06, 2013 5:42 am
by jacque
ThatOneGuy wrote:I am having the same problem with my code. I can get it to load the zip file in the IDE, but it freezes up when I try to use revZipOpenArchive in standalone.
I think yours is a different problem, I think the zip external isn't loading in your standalone.