Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Apr 02, 2020 2:21 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: how to programatically unzip a downloaded file ?
PostPosted: Thu Apr 19, 2007 2:24 pm 
Offline

Joined: Sun Mar 18, 2007 2:42 pm
Posts: 71
Location: Versailles, France
Hi,

I am on Linux ubuntu 6.06

My app is supposed to first download a .zip file from a web site, then unzip such file to extract the csv file (text file) included in such archive, and then exploit the text file.

I manage to download the file.

I have code to exploit the text file once extracted

But I do not find any example of realbasic code that would simply unzip a file.

Can someone help ?

Thanks

Endive


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 19, 2007 6:33 pm 
Offline

Joined: Sun Nov 13, 2005 5:48 pm
Posts: 1073
Location: Gone man...gone.
Sounds like a job for using the shell to use standard unzip programs included with Linux. Since I only use the GUI versions, I don't know which program to call, but I'm sure most distros nowadays have something to decompress the zip file.

I think there are plugins and classes available, as well, but it might be easier to use the shell commands. If you'd like more help, let me know, and I'll get into Linux and see what I can find (I'm stuck in Windows while working).

_________________
God bless and thanks to my friends and fellow RB'ers for the good times!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 2:47 am 
Offline

Joined: Sun Mar 18, 2007 2:42 pm
Posts: 71
Location: Versailles, France
Thanks, it helps.

I'll use the shell.execute instruction of RB and provide as a parameter the shell command line which apparently will use the "unzip" package of the distribution. I'll try and let you know if it does not work.

Endive


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 25, 2008 6:24 pm 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
Endive:

Did you find your solution? Did you come up with a way to do this in all three platforms?

I don't expect it's complicated but I don't have all three to test so it'd be great if you could share it.

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 25, 2008 9:19 pm 
Offline

Joined: Thu May 18, 2006 7:03 am
Posts: 202
I use TT's Zip Package.

http://www.tempel.org/rb/index.html#zip

I have not tested this on Linux, but it works on Mac and Windows. According to a remark in the About Zip Package.html file, it should work on Linux as well.


This is a good product, though I think you have to have Einhugar plugins to work with compressed files.

HTH


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 5:35 am 
Offline

Joined: Thu Jan 26, 2006 8:38 am
Posts: 334
easiest way to do it as ppl have mentioned is just to use the unzip shell program
something like this
dim sh as new shell
dim yourzipfile as folderitem

sh.execute "unzip " + yourzipfile.absolutepath


might be syntax errors coz im not at RB at the moment.

_________________
Faith is a cop-out. It is intellectual bankruptcy. If the only way you can accept an assertion is by faith, then you are conceding that it can't be taken on its own merits.


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 3:13 pm 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
Nice new updated look to the forums.

Hairy_palms: Right, but does that work for all three platforms? Windows includes unzip? I know Linux and OSX do.

Also, it should probably include the quoted path to account for spaces in it.

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 3:21 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
not windows as there's no "unzip" tool built in that you can access like that THAT I KNOW OF

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 4:20 pm 
Offline

Joined: Thu Jan 04, 2007 9:35 am
Posts: 102
Location: Penn USA
can't you extract zip files in xp sp2 without have an unzip software?


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 5:25 pm 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
After searching around a little:

Using a VBScript (works in windows 2003 up to Vista):
http://www.naterice.com/blog/template_p ... .asp?id=64

The function in windows is .copyhere from vb but this all may be too much to run in a sh.execute, I guess.

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 6:05 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
edmerckx99 wrote:
can't you extract zip files in xp sp2 without have an unzip software?


If you can I'd love to know how

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 10:16 pm 
Offline

Joined: Thu May 18, 2006 7:03 am
Posts: 202
You can't do much of anything on a computer without software ;)

The following works on XP SP2. It also extracts the internal file/folder correctly without (at least manually) looping the guts of the zip file.

Just make sure the target zip file exists before you use it. No other testing was done with this. Something I snagged off the net.

Store the text inside your app, write it to a .vbs file, launch it.

HTH

sArchive = "C:\Documents and Settings\HP_Administrator\Desktop\test\TEST.zip"
dLocation = "C:\Documents and Settings\HP_Administrator\Desktop\test"
set oShell = CreateObject("Shell.Application")
oShell.NameSpace(dLocation).CopyHere
oShell.NameSpace(sArchive).Items, &H10&
Set oShell = Nothing


Last edited by RBNUBE on Tue Feb 26, 2008 10:30 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 10:27 pm 
Offline

Joined: Thu May 18, 2006 7:03 am
Posts: 202
In case you have problems with the previous example, this is supposedly an improved version. Both were targetting Windows Server 2003:

sArchive = "C:\test\TEST.zip"
dLocation = "C:\test\"
Set oShell = CreateObject("Shell.Application")
Set oFolder = oShell.NameSpace(sArchive).Items
Set dLocation = oShell.NameSpace(dLocation)
dLocation.CopyHere(oFolder)

http://forums.aspfree.com/windows-scrip ... 60408.html


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Tue Feb 26, 2008 10:57 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
ah yes ... no command line tool like Linux and Unix ...
but this is still useful stuff

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: how to programatically unzip a downloaded file ?
PostPosted: Wed Feb 27, 2008 4:42 am 
Offline

Joined: Thu Jan 26, 2006 8:38 am
Posts: 334
Quote:
Right, but does that work for all three platforms? Windows includes unzip? I know Linux and OSX do.

Also, it should probably include the quoted path to account for spaces in it.

no wont work for windows, but he said he was developing for linux so unzip should definately be there :)

_________________
Faith is a cop-out. It is intellectual bankruptcy. If the only way you can accept an assertion is by faith, then you are conceding that it can't be taken on its own merits.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group