7Zip extraction code needed
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
7Zip extraction code needed
Looking through the forum, there are lots of broken links so I am wondering if anyone has any 7zip extraction code handy.
Specifically, I am trying to extract a single file from a PortableApps format archive (Which PB ZIP cannot open) and haven't found anything.
Has anyone still got a working copy of TS-Soft's includes for PB (Or similar)? The integrated approach is what I want to do.
Specifically, I am trying to extract a single file from a PortableApps format archive (Which PB ZIP cannot open) and haven't found anything.
Has anyone still got a working copy of TS-Soft's includes for PB (Or similar)? The integrated approach is what I want to do.
Last edited by Fangbeast on Fri Jan 30, 2015 7:39 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: 7Zip extraction code needed
http://www.dotnetperls.com/7-zip-examples
The 7za.exe program is used to compress, extract and update files through the command line.
http://www.lampdocs.com/blog/2012/08/7z ... t-windows/
http://sourceforge.net/projects/sevenzi ... p/download
The 7za.exe program is used to compress, extract and update files through the command line.
http://www.lampdocs.com/blog/2012/08/7z ... t-windows/
http://sourceforge.net/projects/sevenzi ... p/download
Keep it BASIC.
Re: 7Zip extraction code needed
Hi FangBeast,
I've a "PureLZMA-500-Installer.exe" but not using, I don't know if it's functional on 5.31, if you need it I can upload and send you a link.
I've a "PureLZMA-500-Installer.exe" but not using, I don't know if it's functional on 5.31, if you need it I can upload and send you a link.
Re: 7Zip extraction code needed
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: 7Zip extraction code needed
Graves, that sounds to be one of Gnozal's old libs right? if that's right, it might work on 5.24 but not on 5.31.graves wrote:Hi FangBeast,
I've a "PureLZMA-500-Installer.exe" but not using, I don't know if it's functional on 5.31, if you need it I can upload and send you a link.
Thanks for the offer.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: 7Zip extraction code needed
Thanks ts-soft, thought your stuff was lost forever. When I tested PB's internal 7zip support, it didn't open my file and I went looking for the compression format which turned out to me LZMA:25 and 7zip itself worked on it.ts-soft wrote:7-zip
Will be trying your code out now instead of sleeping:)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: 7Zip extraction code needed
PB.5.24 LTS tested. x86
PB.5.31 tested. x86
Just tested some example code of TS-Soft's from the forum. On a PortableApps archive, no handle is aquired so the listing fails. 7zip opens and lists it quite fine.
I created a native 7zip archive from my pb files and a handle is aquired opening the archive (so dll's libs etc, must be in the right directory) but instead of filenames, a whole string of 65's are displayed?
Don't know where to go from here.
PB.5.31 tested. x86
Just tested some example code of TS-Soft's from the forum. On a PortableApps archive, no handle is aquired so the listing fails. 7zip opens and lists it quite fine.
I created a native 7zip archive from my pb files and a handle is aquired opening the archive (so dll's libs etc, must be in the right directory) but instead of filenames, a whole string of 65's are displayed?
Don't know where to go from here.
Code: Select all
CurrentDirectory.s = GetCurrentDirectory()
XIncludeFile "7-zip_Include.pbi"
Define.l HARC = SevenZipOpenArchive(0, CurrentDirectory.s + "Address Book U3 v1.15.7z", #ARCEXTRACT_OPEN)
Debug HARC
Define.INDIVIDUALINFO INFO
If HARC
If Not SevenZipFindFirst(HARC, "*.*", @INFO)
Debug INFO\szFileName
While Not SevenZipFindNext(HARC, @INFO)
Debug INFO\szFileName
Wend
EndIf
SevenZipCloseArchive(HARC)
EndIf
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: 7Zip extraction code needed
Why don't you simply use 7za.exe?
What ts-soft posted is very old and will not support LZMA2, which is the new standard compression for 7z files.
What ts-soft posted is very old and will not support LZMA2, which is the new standard compression for 7z files.
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: 7Zip extraction code needed
I'd rather have 7zip integrated than have to shell out to the command line from pb. It's alright for a 1 off (or even a 2 off!!) but when I used the 'shell' method in the past with things like this, I'd often adapt the code to open/read thousands of archives and there has always been a serious memory/resource leak on my machines from windows 7 to 8 to 8.1 to 10.PureGuy wrote:Why don't you simply use 7za.exe?
What ts-soft posted is very old and will not support LZMA2, which is the new standard compression for 7z files.
Never did find out why but it was a windows thing.
P.s. I'm also not familiar with getting information back from an external EXE into PB where I could display it. (Embarrassed look. Never done it yet)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: 7Zip extraction code needed
Perhaps try with this?Fangbeast wrote:P.s. I'm also not familiar with getting information back from an external EXE into PB where I could display it. (Embarrassed look. Never done it yet)
http://www.purebasic.com/documentation/ ... index.html
ReadProgramData()
ReadProgramError()
ReadProgramString()
There are also some useful tips and suggestions regarding Data vs. String here on forum from guys, make sure you go through them!
Re: 7Zip extraction code needed
Code: Select all
ReadProgramData()
ReadProgramError()
ReadProgramString()
Re: 7Zip extraction code needed
Hi Fangbeast,
- http://www.purebasic.fr/english/viewtop ... 12&t=61534
NB*: I haven't added any examples yet, but I will when time permits.
I redid the Interface to the latest libraries, and documentation suggests that LZMA2 is supported; you may have better luck with this new version?PureGuy wrote:What ts-soft posted is very old and will not support LZMA2, which is the new standard compression for 7z files
- http://www.purebasic.fr/english/viewtop ... 12&t=61534
NB*: I haven't added any examples yet, but I will when time permits.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: 7Zip extraction code needed
I'll have a go at it after shopping today, have several 'styles' of 7zip compressed files to try it on. Your useful help is appreciatedJHPJHP wrote:Hi Fangbeast,
I redid the Interface to the latest libraries, and documentation suggests that LZMA2 is supported; you may have better luck with this new version?PureGuy wrote:What ts-soft posted is very old and will not support LZMA2, which is the new standard compression for 7z files
- http://www.purebasic.fr/english/viewtop ... 12&t=61534
NB*: I haven't added any examples yet, but I will when time permits.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
- Fangbeast
- PureBasic Protozoa
- Posts: 4790
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: 7Zip extraction code needed
Okay, tried it. Can open the archive I created with 7zip but cannot open the PortableApps EXE archive. Says "Cannot open 'foo.exe' as archive.
7zip itself can open it and definately lists the compression format for those as LZMA:25 so I don't know what I am missing.
7zip itself can open it and definately lists the compression format for those as LZMA:25 so I don't know what I am missing.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: 7Zip extraction code needed
Hi Fangbeast,
I'm sorry to say that packed executables are not supported. The interface has the same functionality as the 7-zip command line tool (7za.exe): 7z and zip.
- this means that a command line interface is also not an option
I'm sorry to say that packed executables are not supported. The interface has the same functionality as the 7-zip command line tool (7za.exe): 7z and zip.
- this means that a command line interface is also not an option
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.