View previous topic :: View next topic |
Author |
Message |
Tdk161 Valued Contributor
Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Wed Mar 23, 2011 10:54 pm Post subject: Zip view help! [SOLVED] |
|
|
Hi forum,
are a lot of week, i'm tring to create a gui to view a zipfile content using the sszip lib.
I would like (I need) to create a view like winzip or winrar files/folder view,
but I don't understand how
someone can help me please?
Many thanks in advance for any info or idea
Last edited by Tdk161 on Mon Apr 25, 2011 11:55 am; edited 2 times in total |
|
Back to top |
|
|
uvedese Contributor
Joined: 21 Jan 2006 Posts: 169 Location: Spain
|
|
Back to top |
|
|
uvedese Contributor
Joined: 21 Jan 2006 Posts: 169 Location: Spain
|
Posted: Thu Mar 24, 2011 5:47 pm Post subject: |
|
|
Unfortunately I can not load the libraries because they are not compatible with Windows Vista
I can't run "PequeZip"
|
|
Back to top |
|
|
uvedese Contributor
Joined: 21 Jan 2006 Posts: 169 Location: Spain
|
Posted: Thu Mar 24, 2011 8:07 pm Post subject: |
|
|
Oops
It's my fault. Libraries are compatible. I don't know why not run in my computer (desktop). In my portable PC is fine.
|
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Mar 24, 2011 9:02 pm Post subject: |
|
|
are you using old library files? download the latest versions and see if that works on your system.
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
Tdk161 Valued Contributor
Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Sun Mar 27, 2011 12:24 am Post subject: |
|
|
Ok, guys
Maybe I didn't explain well my trouble, sorry
There is my script:
Code: |
External sszip.dll
#Define command,sszip
#define function,sszip,Carica
%x =
%d =
%h = 0
%%mPath = ""
DIALOG CREATE,Test Zip,-1,0,674,327,ONTOP
DIALOG ADD,STYLE,STYLE1,Verdana,,B,,
DIALOG ADD,BUTTON,Open,8,255,64,24,Open Zip
DIALOG ADD,TABLE,TABLE1,34,8,315,245,dati[380],COLUMNSORT,DBLCLICK
DIALOG ADD,TEXT,TEXT1,290,8,332,15,TEXT1,,STYLE1
DIALOG ADD,BUTTON,Root,5,183,64,24,Root
# DIALOG ADD,TABLE,TABLE2,39,330,320,243,Column 1[80]|Column 2[80]|Column 3[80]
DIALOG SHOW
%%Zip = c:\pippo.zip
:Loop
If %%Zip
Dialog Set,Text1,[%%mPath]
List Clear,Table1
# List Clear,Table2
%c = @SSzip(LIST,%%Zip)
List Append,Table1,@Carica(%c,%%mPath)
End
Wait Event
%e = @Event()
Goto %e
:RootBUTTON
%%mPath =
Goto Loop
:OpenButton
%%Zi = @FileDlg("Zip|*.zip|",Apri)
If %%Zi
%%Zip = %%Zi
%i = 0
End
Goto Loop
:Table1DBLCLICK
#%p = @Substr(@Item(TaBLE1),1,@Pred(@Pos(\,@Item(TaBLE1))))
%p = @SSZIP(FILEINFO,%%Zip,@SSZIP(FIND,%%Zip,@Item(TaBLE1),),p)
If %p
%h = @SSZIP(FIND,%%Zip,%p,)
If 1
%%mPath = %%mPath%p
End
End
Goto Loop
:Close
Stop
:Carica
List Clear,Table1
%z = @New(LIST,SORTED)
List Append,%z,%1
%%Rit =
%l =
%p =
%i =
Repeat
%l = @Next(%z)
If %l
%d = @SSZIP(FILEINFO,%%Zip,@SSZIP(FIND,%%Zip,%l,),a)
%u = @SSZIP(FILEINFO,%%Zip,@SSZIP(FIND,%%Zip,%l,),p)
If @Equal(%d,A,exact)
If @Equal(%%mPath,%u)
%%Rit = %%Rit@Name(%l).@Ext(%l)@Cr()
End
ElsIf @Equal(%d,D,EXACT)
If @UnEqual(%%mPath,%u)
%%Rit = %%Rit%u@Cr()
End
End
End
Until @Not(%l)
List Close,%z
Exit %%Rit |
work well but when i select a subfolder inside the opend zip, Not work, does not display the files and folders in the selected folder like in the root I don't understand why
Now I hope I was clearer
Byez and thank
|
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sun Mar 27, 2011 6:19 pm Post subject: |
|
|
I don't remember using any of the zip extensions, but I'm pretty sure that if there's a path with each of the files, then you need to sort these paths yourself when you read the zip file in your program and display only the top level files along with any subfolders you have, but do not display the files in the subfolders until you double click on them, then you get a list of the files in that subfolder and update your display with only those files.
Code: | myzipfile.zip
Contents of zip file:
readme.txt
install.exe
install files/file 1.dat
install files/file 2.dat
install files/file 3.dat
install files/file 4.dat
install files/file 5.dat
|
So, you have 2 files in the root and then 5 files in a subfolder. When you read the zip file only display the two root files and then a folder for the "install files" folder and stop there, do not display the files in that subfolder.
Code: | myzipfile.zip
Contents of zip file:
readme.txt
install.exe
[install files]
|
Now if you double click on the "install files" folder, you in your code will put a list of files together of what is in the "install files" folder, empty your display and now update the display with only the files from the "install folder". Of course add an entry for going back up to the root.
Now your display should show this:
Code: | myzipfile.zip
Contents of zip file:
[..]
file 1.dat
file 2.dat
file 3.dat
file 4.dat
file 5.dat
|
I hope you can understand what I mean by this. Good luck and have fun,
~Garrett
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
Tdk161 Valued Contributor
Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Mon Mar 28, 2011 1:09 am Post subject: |
|
|
Hello Garrett,
are aware of what you said to me, for you have confirmed my idea,
my problem is that I can not get it done on my script, they are several weeks that I'm trying to figure out how to do, but unfortunately so far without results
Thank you anyway
|
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Mar 28, 2011 7:19 pm Post subject: |
|
|
The concept is in fact quite simple, I can even see the code in my mind. You might be thinking in complicated terms. Erase what you are thinking and start over, but this time think in simple terms. It's all in the internal LIST. You read in the zip file into your internal list and you simply go through the list only display the root files and the folders in the root file at first. Double click on a folder in that list, you have the name of it now, so go through your internal list and look for the entries that have that folder, grab each entry for that folder, put them in a new internal LIST, now you simply clear your display and start filling it with your new list. You don't need to read the zip file again since you already have the entire contents of the list file in your first LIST. Also keep a variable with your current path within the zip file.
Other than writing this for you, I can't spell it out any easier than this. If you just look at this in simple terms I believe you will see it. It is less than a day's worth of coding too. Just clear your mind and think in simple terms.
~Garrett
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
Tdk161 Valued Contributor
Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Fri Apr 01, 2011 2:58 pm Post subject: |
|
|
Garrett,
safe and simple, I deleted from my mind on my old idea but probably are too stubborn to be able to implement the ' idea that you kindly explained to me.... Result I can not even get the view I want, and I'm still breaking my head to be able to obtain
anyway thank you so much for the explanations you have given me
Cheers
|
|
Back to top |
|
|
Tdk161 Valued Contributor
Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Mon Apr 18, 2011 2:58 pm Post subject: |
|
|
Hi,
I have been trying unsuccessfully for a long time to get what I have already explained, but without any appreciable result, and I'm really mad.
there's really no one here who can kindly help me? Maybe posting a code sample?
I think it's the same procedure to display in a table the contents of a folder, more or less
Humbly await your help
Thanks
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Mon Apr 18, 2011 4:49 pm Post subject: |
|
|
not relevant. See my new post below
Last edited by cnodnarb on Mon Apr 18, 2011 11:55 pm; edited 1 time in total |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Mon Apr 18, 2011 11:55 pm Post subject: |
|
|
Good thing I'm on spring break and I'd never tried this before.
To be honest, I would extract the zip to a temp folder and have the user open the dang thing in explorer, windows wizard style.
Here ya go. It's a little rough around the edges but your talented enough to smooth it out.
Code: | External sszip.dll
#Define command,sszip,array
#define function,sszip
DIALOG CREATE,Test Zip,-1,0,674,327,ONTOP
DIALOG ADD,STYLE,STYLE1,Verdana,,B,,
DIALOG ADD,BUTTON,Open,8,255,64,24,Open Zip
DIALOG ADD,TABLE,TABLE1,34,8,315,245,dati[380],COLUMNSORT,DBLCLICK
DIALOG ADD,TEXT,TEXT1,290,8,332,15,TEXT1,,STYLE1
DIALOG ADD,BUTTON,Root,5,183,64,24,Root
dialog add,list,dirarray,0,0,0,0
dialog add,list,fullist,0,0,0,0
dialog add,list,level0,0,0,0,0
dialog add,list,matchcheck,0,0,0,0
# DIALOG ADD,TABLE,TABLE2,39,330,320,243,Column 1[80]|Column 2[80]|Column 3[80]
DIALOG SHOW
%%Zip = @path(%0)richedit.zip
:init
%%l = 0
%%maxlevel = 0
%c = @SSzip(LIST,%%Zip)
dialog set,fullist,%c
%%operation = addtolevel
:level
if @null(@text(fullist))
goto evloop
end
%%list = fullist
list seek,%%list,0
repeat
gosub %%operation
list seek,%%list,@succ(@index(%%list))
until @equal(@index(%%list),@pred(@count(%%list)))
gosub %%operation
dialog set,table1,@text(level0)
:evloop
dialog set,text1,%%matchthis - %%l
wait event
goto @event()
:close
exit
:array
rem dialog add,list,%1,0,0,0,0
list clear,%1
repeat
parse "%3;%4",%2
%5 = @substr(%2,@sum(@len(%3),2),@len(%2))
if %3
list add,%1,%3
%2 = %5
end
until @null(%3)
exit
:addtolevel
option fieldsep,\
array dirarray,@item(%%list)
if @greater(@count(dirarray),%%maxlevel)
%%maxlevel = @count(dirarray)
end
list clear,matchcheck
if @equal(%%l,0)
list add,matchcheck,@item(dirarray,%%l)
%%matchthis = @item(dirarray,%%l)
end
list add,matchcheck,@item(dirarray,@pred(%%l))
if @match(matchcheck,%%matchthis)
if @not(@match(level0,@item(dirarray,%%l)))
if @not(@equal("",@item(dirarray,%%l)))
list add,level0,@item(dirarray,%%l)
end
end
end
exit
:table1dblclick
if @not(@equal(%%l,0))
if @equal(%%matchthis,@item(table1))
%%l = @diff(%%l,1)
list clear,level0
%%matchthis = %%lastmatchthis
goto level
end
end
%%lastmatchthis = %%matchthis
%%matchthis = @item(table1)
%%l = @succ(%%l)
list clear,level0
goto level
:rootbutton
%%lastmatchthis = ""
%%matchthis = ""
%%l = 0
list clear,level0
goto level
:openbutton
%%zip = @filedlg(*.zip)
if %%zip
list clear,level0
list clear,table1
%%lastmatchthis = ""
%%matchthis = ""
%%l = 0
goto init
else
goto evloop
|
|
|
Back to top |
|
|
Tdk161 Valued Contributor
Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Sun Apr 24, 2011 6:43 pm Post subject: |
|
|
Sorry TDK, I can't find the trouble.
The root of the subfolder is listed as the top item...is that the trouble?
That's there so they can double click it and go back down one level.
Once again, did not experience difficulty.
Can you be more explicit?
Thanks,
cnodnarb
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|