Liberty BASIC Community Forum
Liberty BASIC Programming Discussions >> Liberty BASIC Code >> unzipping file

unzipping file
Post by Bob 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
Re: unzipping file
Post by robmcal on Sep 8th, 2017, 4:10pm

7-zip has a command line version. You may try using that.
Re: unzipping file
Post by Bob on Sep 8th, 2017, 10:19pm

I have downloaded 7-zip but do not see any tutorials for programming.
Re: unzipping file
Post by robmcal on Sep 8th, 2017, 10:34pm

Not exactly sure how to use it myself. The command line syntax is described on this page.

Re: unzipping file
Post by tenochtitlanuk 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.
    '   7za.exe extracts all files from *.zip to the current directory.


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

    run "7za.exe e " +zipFile$


Re: unzipping file
Post by Bob 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.

Re: unzipping file
Post by Rod on Sep 10th, 2017, 02:03am

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

Re: unzipping file
Post by Bob on Sep 20th, 2017, 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.
Re: unzipping file
Post by robmcal on Sep 20th, 2017, 10:18pm
Re: unzipping file
Post by Bob on Sep 21st, 2017, 8:50pm

Thanks for link. I have found an alternate fix and will hope it continues to work. I created a shortcut for desktop for LibertyBasic directory. For some reason the recently used files link in Windows 10 was not accessing from this directory.
Re: unzipping file
Post by Rod on Sep 22nd, 2017, 01:40am

Check the version number of Liberty BASIC displayed at top left of the IDE. You might have linked to an older version of Liberty. This will not have a corrupted .ini file and so will start and display normally.

If you have the corrupt .ini file problem we assumed you had it can ONLY be fixed by editing the .ini file or removing it and reinstalling a fresh version.

If you had Liberty open and displaying on the toolbar but no window visible then you do have a corrupted .ini file. This happens when you close Liberty whilst it is minimised, it is given silly window parameters by Windows which it remembers and so prevents the main IDE window opening, only the toolbar icon is displayed.

What version of Liberty do you have installed and do you still have older versions stored on disk? Liberty just creates a new directory and leaves old versions alone. So if you did not delete an older version it will still be on disk.