[solved] 7-zip dll in AHK

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: [solved] 7-zip dll in AHK

18 Sep 2015, 15:50

This is the function I made for my std lib folder. You can change it to your liking. What it takes in is command-line commands for 7-zip, which you can find documentation for here. Use the .chm.

Code: Select all

7ZipCLine(sCommand) {
    fileInstall C:\Program Files\AutoHotkey\FInstalls\7-zip32.dll,%tmp%\7-zip32.dll
    fileInstall C:\Program Files\AutoHotkey\FInstalls\7-zip64.dll,%tmp%\7-zip64.dll
    static sevPrc,sevProc2,lib
    if(!sevProc){
        sevProc:=1,lib:=tmp "\7-zip" (a_ptrSize=4?"32":"64") ".dll"
        if(!fileExist(lib)){
                        }
        sevPrc:=dllCall("LoadLibrary","Str",lib,"Ptr")
        sevProc2:=dllCall("GetProcAddress","Ptr",sevPrc,"AStr","SevenZip","Ptr")
    }
    aRet:=dllCall(sevProc=1?sevProc2:sevProc, "Ptr", a_scriptHwnd,"AStr", sCommand,"Ptr", 0,"Int", 0)    
    if(!ErrorLevel)
        return aRet
    return 0
}
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
zotune
Posts: 85
Joined: 17 Nov 2014, 17:57

Re: [solved] 7-zip dll in AHK

23 Sep 2015, 06:31

Thanks Masonjar

Couple of things, only A_PtrSize=8 works for me to determine if I have a 64bit system

I'm not sure I understand the point of this:

Code: Select all

if(!fileExist(lib)){
                        }
Extracting archive with 7zip-32.dll works, but not 7zip-64.dll, even if I fix A_PtrSize. What gives? (using this version: http://homepage1.nifty.com/Ayakawa/soft/ntutil.html)

Kind regards
Mikael
zotune
Posts: 85
Joined: 17 Nov 2014, 17:57

Re: [solved] 7-zip dll in AHK

30 Sep 2015, 10:45

Bump! Anyone got 7zip-64.dll working? I'm sure it's not a major difference, although I'm curious.
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: [solved] 7-zip dll in AHK

05 Sep 2019, 04:12

Masonjar13 wrote:
18 Sep 2015, 15:50
This is the function I made for my std lib folder. You can change it to your liking. What it takes in is command-line commands for 7-zip, which you can find documentation for here. Use the .chm.

Code: Select all

7ZipCLine(sCommand) {
    fileInstall C:\Program Files\AutoHotkey\FInstalls\7-zip32.dll,%tmp%\7-zip32.dll
    fileInstall C:\Program Files\AutoHotkey\FInstalls\7-zip64.dll,%tmp%\7-zip64.dll
    static sevPrc,sevProc2,lib
    if(!sevProc){
        sevProc:=1,lib:=tmp "\7-zip" (a_ptrSize=4?"32":"64") ".dll"
        if(!fileExist(lib)){
                        }
        sevPrc:=dllCall("LoadLibrary","Str",lib,"Ptr")
        sevProc2:=dllCall("GetProcAddress","Ptr",sevPrc,"AStr","SevenZip","Ptr")
    }
    aRet:=dllCall(sevProc=1?sevProc2:sevProc, "Ptr", a_scriptHwnd,"AStr", sCommand,"Ptr", 0,"Int", 0)    
    if(!ErrorLevel)
        return aRet
    return 0
}
According to the novices, can you make an example?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Google [Bot], mikeyww, RickC and 261 guests