Jump to content

Recommended Posts

Posted

Hey everyone. Just a quick one. I'm wondering if anyone knows how I can add more items to the code below. I have tried to use "&" but its not working

Thanks

$aZipList = _ZipList2Array($szZipFile)
for $x =0 to UBound($aZipList)-1
    If StringLower(StringRight($aZipList[$x][1],4)) = ".png"&".gif" Then;THIS LINE IS THE PROBLEM
       ConsoleWrite("Extracting:"&$aZipList[$x][1])
        $vResult = _ZipUnZipItem($szZipFile,$aZipList[$x][1],$szDestDir)
        ConsoleWrite(" -- "&_ZipFormatMessage($ZR_RECENT)&@lf)
Posted (edited)

Thanks...

One question thats now come to my mind. What if i wanted to include 4 different file types, would i just add more with "OR"

Update

--------

The code sems to copy the files, but now returns an error

C:\Program Files (x86)\AutoIt3\Include\AVIConstants.au3 (11) : ==> Can not redeclare a constant.:

Global Const $ACS_CENTER = 1

Global Const ^ ERROR

Edited by jben
Posted (edited)

It seems like the code is causing an issue, for some reason??.

here is the code, thought it might help to post it here.

$szZipFile = $targetDir &"DATA_CHILD.zip";this is the zip file to extract
$szDestDir = "C:\OUTPUT";this is the destination to extract the zip files

$aZipList = _ZipList2Array($szZipFile)
for $x =0 to UBound($aZipList)-1
    If StringLower(StringRight($aZipList[$x][1],4)) = ".png" Then;this code extracts the files
       ConsoleWrite("Extracting:"&$aZipList[$x][1])
        $vResult = _ZipUnZipItem($szZipFile,$aZipList[$x][1],$szDestDir)
        ConsoleWrite(" -- "&_ZipFormatMessage($ZR_RECENT)&@lf)
        

    EndIf   
Next
Edited by jben
Posted

Thanks...

One question thats now come to my mind. What if i wanted to include 4 different file types, would i just add more with "OR"

Yes, however there is no need to continue checking strinstr-right 4

just do it this way

for $x =0 to UBound($aZipList)-1
    $pic_type = StringLower(StringRight($aZipList[$x][1],4))
    If $pic_type = ".png" Or $pic_type = ".gif" Or $pic_type = ".tif" Or $pic_type = ".bmp" Then;THIS LINE IS THE PROBLEM

Update

--------

The code sems to copy the files, but now returns an error

C:\Program Files (x86)\AutoIt3\Include\AVIConstants.au3 (11) : ==> Can not redeclare a constant.:

Global Const $ACS_CENTER = 1

Global Const ^ ERROR

there is not enough code here to be sure, however it appears to be a duplicated globilized construct within two different "includes". just look inside the "includes" for this Global Contruct. most likely you can just remove it from the AVIConstants.au3

open the include, just place a semicolon here, and save it

; Global Const $ACS_CENTER = 1

^ right there

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

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