Jump to content

UnZIP.au3 UDF Issue


Recommended Posts

Hey Guys, Sorry for the necro. But, I figured rather post here than create a new topic only to reference this one.

In the script I've made, I'm downloading a zip folder and trying to unzip it. Clearly as this is what the UDF is intended for. Though I'm experiencing some issues, Which I'm not exactly sure what the problem is, As my code is similar to the code in the example provided. So here it is, My code snippet;

$sZIP = @ScriptDir & "\Plugins\" & $RequestedPlugin & ".zip" ; full path to your zip
$sFile = "" & $RequestedPlugin & ".exe" ; file inside the zip
Call("UnZIP_SaveFileToFileOnce", $sZIP, $sFile)

Also, I have included the UDF in the script and, Everything up until these three lines works fine. No error messages are generated by SciTe and, My script continues to work otherwise.

UDF Link: '?do=embed' frameborder='0' data-embedContent>>

Link to comment
Share on other sites

Though I'm experiencing some issues, Which I'm not exactly sure what the problem is, As my code is similar to the code in the example provided. So here it is, My code snippet;

You forgot to tell us what the issues are.

Everything up until these three lines works fine. No error messages are generated by SciTe and, My script continues to work otherwise.

 

UDF Link: '?do=embed' frameborder='0' data-embedContent>>

If there are no error messages and the script runs fine what is the problem you're having?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You forgot to tell us what the issues are.

If there are no error messages and the script runs fine what is the problem you're having?

 

Hmm, The compressed file is not being uncompressed. IE: Folder.zip -> File.exe = No uncompressed folder or file(Using the code I supplied). I hope that clarifies the issue.

Link to comment
Share on other sites

Can you post your script or at least a reproducer script that demonstrates the problem? Right now it's hard to say what's going on with so little information to work with.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Sorry, I can't really provide a reproducer script without giving you the incomplete project and pointing you directly at my test server. This code fires when my script detects "enter" being pressed within a GUI Input(Also, InputData[2] is what I'm looking for as it is a parameter of a custom command). The compressed zip file is downloaded prior to this code being executed. Everything works except the three lines of UnZIP specific code.

$InputData = StringSplit("" & GUICtrlRead($Input1, "") & "", " ", 1)

If _IsPressed("0D", $hDLL) And WinActive("" & $Title & " v" & $Version & " by " & $Author & "", "") And $InputData[1] = "/dlp" And $InputData[0] > "1" Then
                GuiCtrlSetData($Input1, "")
            $RequestedPlugin = $InputData[2]
        $LocalAddress = IniRead("Config.ini", "Global Settings", "Address", "")
        $DownloadName = IniReadSectionNames("" & @TempDir & "\downloads.ini")
         For $i = 0 To $DownloadName[0]
               If StringCompare("" & $DownloadName[$i] & "", "" & $RequestedPlugin & "") = "0" Then
                    MsgBox(0, "", "Attempting to download " & $RequestedPlugin & "")
                  $DownloadPath = IniRead("" & @TempDir & "\downloads.ini", "" & $RequestedPlugin & "", "Download", "")
                    MsgBox(0, "", "Attempting to access the following path: " & $LocalAddress & "" & $DownloadPath & "")
                    MsgBox(0, "", "Attempting to download: " & $LocalAddress & "" & $DownloadPath & "")
                  InetGet("" & $LocalAddress & "" & $DownloadPath & "", "" & @ScriptDir & "\" & $RequestedPlugin & ".zip", 1, 0) 
                    MsgBox(0, "", "Attempting to move the file:")
                  FileMove("" & @ScriptDir & "\" & $RequestedPlugin & ".zip", "" & @ScriptDir & "\Plugins", 1)
                  $sZIP = "" & @ScriptDir & "\Plugins\" & $RequestedPlugin & ".zip" ; full path to your zip
                  $sFile = "" & $RequestedPlugin & ".exe" ; file inside the zip
                  Call("UnZIP_SaveFileToFileOnce", $sZIP, $sFile)
               ElseIf StringCompare("" & $DownloadName[$i] & "", "" & $RequestedPlugin & "") <> "0" Then
                    MsgBox(0, "", "Error: " & $RequestedPlugin & " not found!")
                  Sleep("100")
               EndIf
         Next

Note: The MsgBox's are for debugging purposes(Though they're not very informative if you're unfamiliar with the code). FileMove is the last working line of code, Though no errors are generated when SciTe reads over the UnZIP code. The compressed zip is simply not decompressed or, touched otherwise. Sorry for any bad coding etiquette.

Edited by BlackDawn187
Link to comment
Share on other sites

I may have possibly found a solution to my own problem, But I would like some input from other community members. I found a .vbs file that can unzip compressed folders, I was thinking of writing the .vbs from within a AutoIt function, Then execute it at the required time. The exact vbs code is as follows;

strZipFile = "C:\Users\Your_Username_Here\Documents\Example\Example.zip"
outFolder = "C:\Users\Your_Username_Here\Documents\Example\"
    
Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions

Writing this from within AutoIt, We can set the strZipFile & outFolder using @ScriptDir & @ScriptName macros.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...