why doesnt work ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • mustafa06
    Forum Member
    • Jul 2007
    • 287

    why doesnt work ?

    -- Get contents from secure zip file (no password is needed to view contents of file)
    tZipContents = Zip.GetContents("AutoPlay\\Bla Bla\\Hua\\musti.dat", false);

    -- Traverse through the contents table, adding the items to the ListBox one by one.
    for nIndex in tZipContents do
    Application.LoadScript("AutoPlay\\Bla Bla\\Hua\\dat4.lua");
    end
  • RizlaUK
    Indigo Rose Customer
    • May 2006
    • 5478

    #2
    whats in "dat4.lua" ??
    Embrace change in your life, you never know, it could all work out for the best

    Comment

    • mustafa06
      Forum Member
      • Jul 2007
      • 287

      #3
      Originally posted by RizlaUK View Post
      whats in "dat4.lua" ??
      Application.Exit()

      but program doesnt close because dont open .lua ....

      Comment

      • RizlaUK
        Indigo Rose Customer
        • May 2006
        • 5478

        #4
        try this

        Code:
        -- Get contents from secure zip file (no password is needed to view contents of file)
        tZipContents = Zip.GetContents("AutoPlay\\Bla Bla\\Hua\\musti.dat", false);
        
        -- Traverse through the contents table, adding the items to the ListBox one by one.
        for nIndex, sScript in tZipContents do
        Application.LoadScript("AutoPlay\\Bla Bla\\Hua\\dat4.lua");
        end
        you were not indexing anything in your for loop
        Embrace change in your life, you never know, it could all work out for the best

        Comment

        • jassing
          Indigo Rose Customer
          • Jan 2001
          • 3124

          #5
          Originally posted by mustafa06 View Post
          -- Get contents from secure zip file (no password is needed to view contents of file)
          tZipContents = Zip.GetContents("AutoPlay\\Bla Bla\\Hua\\musti.dat", false);

          -- Traverse through the contents table, adding the items to the ListBox one by one.
          for nIndex in tZipContents do
          Application.LoadScript("AutoPlay\\Bla Bla\\Hua\\dat4.lua");
          end
          did you check to be sure the .dat file exists and is a valid zip file?
          where do yuo unzip the file to?
          what is nIndex used for?
          so if your "zip" file (nusti.dat) has 35 files in it; you want to load "dat4.lua" 35 times?

          Comment

          • ShadowUK
            No longer a forum member
            • Oct 2007
            • 1321

            #6
            This code is really wrong, You can't get contents using the ZIP libary, from a DAT file.

            You're loading the same file lots of times. And it will only load it once, You should be using Application.RunScriptFile and not Application.LoadScript if you want to load the same file multiple times.

            and your loop should look like this:
            Code:
            for i, v in Zip.GetContents("That\\File.zip", false) do
                 Application.RunScriptFile("AutoPlay\\Scripts\\file-action"..i..".lua");
            end
            This goes through That\File.zip (not including folder names) and then runs the script file-action(number).lua. You could also do something like

            Code:
            result = Zip.GetContents("AutoPlay\\Docs\\Archive1.zip");
            for i, v in result do
               ListBox.AddItem("ListBox1", v, i);
            end
            That'll add the files to the ListBox, Of course you could always just modify the code, But trying to get files from with in a RAR for example, Is not possible, To my knowledge anyway.

            Comment

            • mustafa06
              Forum Member
              • Jul 2007
              • 287

              #7
              Originally posted by ShadowUK View Post
              This code is really wrong, You can't get contents using the ZIP libary, from a DAT file.

              You're loading the same file lots of times. And it will only load it once, You should be using Application.RunScriptFile and not Application.LoadScript if you want to load the same file multiple times.

              and your loop should look like this:
              Code:
              for i, v in Zip.GetContents("That\\File.zip", false) do
                   Application.RunScriptFile("AutoPlay\\Scripts\\file-action"..i..".lua");
              end
              This goes through That\File.zip (not including folder names) and then runs the script file-action(number).lua. You could also do something like

              Code:
              result = Zip.GetContents("AutoPlay\\Docs\\Archive1.zip");
              for i, v in result do
                 ListBox.AddItem("ListBox1", v, i);
              end
              That'll add the files to the ListBox, Of course you could always just modify the code, But trying to get files from with in a RAR for example, Is not possible, To my knowledge anyway.
              for i, v in Zip.GetContents("AutoPlay\\musti\\Data\\musti.zip" , false) do
              Application.RunScriptFile("AutoPlay\\musti\\Data\\ "..i..".lua");
              end


              musti.zip in dat.lua , dat.lua in Application.Exit

              I write this code on preload event but doesnt close ....

              Comment

              • RizlaUK
                Indigo Rose Customer
                • May 2006
                • 5478

                #8
                This code is really wrong, You can't get contents using the ZIP libary, from a DAT file.
                i agree that the code seems a little strange, "why would you want to do that" sort of thing.....but at this stage i give up asking questions!!

                you can infact name a zip file anything you like .xyz even, AMS will still read it as a zip
                Embrace change in your life, you never know, it could all work out for the best

                Comment

                Working...
                X