Liberty BASIC Community Forum
« unzipping file »

Welcome Guest. Please Login or Register.
Sep 21st, 2017, 10:51am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: unzipping file  (Read 149 times)
Bob
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 4
xx unzipping file
« Thread started on: Sep 7th, 2017, 10:31pm »

Hello to all,

I am a novice programmer to just about everyone on here and new to this forum. I have used Liberty Basic off and on for over 10 years for the main purpose of writing, using and updating a horse racing handicapping program that I wrote. I learned basic way back in college and never had a good tutorial on using commands to unzip files, calls, dlls, etc. I am currently downloading zipped racing files from a website, unzipping them in winzip, opening the file in excel due to use of commas in the data (original unzipped date file is comma delimited but uses ""), renaming the file and then opening it with my program. I would like to expedite this process. Can anyone direct me to a good link that can teach me how to start the filedialog and open the zip file within my program?

Thank you
Bob
User IP Logged

robmcal
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 399
xx Re: unzipping file
« Reply #1 on: Sep 8th, 2017, 4:10pm »

7-zip has a command line version. You may try using that.
User IP Logged

Definition of an Upgrade: Take old bugs out, put new ones in.
Bob
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 4
xx Re: unzipping file
« Reply #2 on: Sep 8th, 2017, 10:19pm »

I have downloaded 7-zip but do not see any tutorials for programming.
User IP Logged

robmcal
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 399
xx Re: unzipping file
« Reply #3 on: Sep 8th, 2017, 10:34pm »

Not exactly sure how to use it myself. The command line syntax is described on this page.
https://sevenzip.osdn.jp/chm/cmdline/syntax.htm
User IP Logged

Definition of an Upgrade: Take old bugs out, put new ones in.
tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1162
xx Re: unzipping file
« Reply #4 on: Sep 9th, 2017, 2:02pm »

If you've downloaded 7za.exe to the directory holding your LB code, try the following which worked for me. Don't know what files are in your zip file nor what you'll do with them. If you KNOW filenames you can now parse them. If not you may need another filedialog to select a file....
There are examples about parsing csv files and delimiter problems around this forum and elsewhere.
Code:
    '   7za.exe extracts all files from *.zip to the current directory.

    nomainwin

    filedialog "Choose zip file", "*.zip", zipFile$

    run "7za.exe e " +zipFile$



 
User IP Logged

Bob
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 4
xx Re: unzipping file
« Reply #5 on: Sep 9th, 2017, 7:06pm »

Thank you tenochtitlanuk

This makes sense to open the zip file into the directory. I could then determine the filename selected as the zip file and unzip file have the same name and automatically select the unzipped file. I'll let you know how this turns out.

My next issue would be reprogramming how I have inputted the unzipped file. While the original unzipped file is comma delimited it does have quotes around the text data (ie "AQU",1,"Track",35). I currently change this file to a csv in excel and input data with simple character for comma to delimit the data. This would not work with the original unzipped file. Any suggestions for an easy correction to the programming code would be helpful.
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5526
xx Re: unzipping file
« Reply #6 on: Sep 10th, 2017, 02:03am »

There is a new inputcsv command which you should experiment with.
User IP Logged

Bob
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 4
xx Re: unzipping file
« Reply #7 on: Yesterday at 10:08pm »

I placed the 7zip file in my Liberty Basic directory and now I cannot access Liberty Basic. Any help would be appreciated. The icon shows on the tool bar but does not show the window, it appears to be in constant minimized stated.
User IP Logged

robmcal
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 399
xx Re: unzipping file
« Reply #8 on: Yesterday at 10:18pm »

http://libertybasic.conforums.com/index.cgi?board=general&action=display&num=1482348124
User IP Logged

Definition of an Upgrade: Take old bugs out, put new ones in.
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls