taietel Posted September 2, 2010 Posted September 2, 2010 Works for me! Maybe you have forgot to put your phonetree.csv in your script directory? Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
bb01 Posted September 2, 2010 Posted September 2, 2010 (edited) nope, got the phonetree.csv in my root folder, got also the test.exe (the script) there aswell & it creates a phonetree.zip thats only 1kb & is blank inside. Using Windows XP Pro Edited September 2, 2010 by bb01
taietel Posted September 2, 2010 Posted September 2, 2010 XP Pro also here! tryed your script, before editing:#include <_Zip.au3>Global $sFileName=@ScriptDir & "\phonetree.zip"Global $iOverwrite=1Global $sZipFile=@ScriptDir & "\phonetree.zip"Global $sFileAddName=@ScriptDir & "\phonetree.csv"Global $sDestDir="\"Global $iFlag=77;create the phonetree.zip_Zip_Create($sFileName, $iOverwrite);Then to add phonetree.csv to the zip_Zip_AddItem($sZipFile, $sFileAddName, $sDestDir, $iFlag)with no problems. Also tried with other files also. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
wraithdu Posted September 3, 2010 Author Posted September 3, 2010 Works for me too on Win7. What's the console output of the following: #include <_Zip.au3> Global $sFileName=@ScriptDir & "\phonetree.zip" Global $iOverwrite=1 Global $sZipFile=@ScriptDir & "\phonetree.zip" Global $sFileAddName=@ScriptDir & "\phonetree.csv" Global $sDestDir="\" Global $iFlag=77 ;create the phonetree.zip $r = _Zip_Create($sFileName, $iOverwrite) ConsoleWrite(@error & " : " & $r & @CRLF) ;Then to add phonetree.csv to the zip $r = _Zip_AddItem($sZipFile, $sFileAddName, $sDestDir, $iFlag) ConsoleWrite(@error & " : " & $r & @CRLF)
TheSaint Posted September 3, 2010 Posted September 3, 2010 (edited) @bbo - Perhaps (as listed at #40);create the phonetree.zip_Zip_Create("\phonetree.zip",1)should have been;create the phonetree.zip_Zip_Create($sZipFile,1) Edited September 3, 2010 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
bb01 Posted September 3, 2010 Posted September 3, 2010 (edited) found the problem it was because i had the \ before the filenames, therefore it was trying to find C:\\phonetree.zip #include <_Zip.au3> Global $sFileName=@ScriptDir & "phonetree.zip" Global $iOverwrite=1 Global $sZipFile=@ScriptDir & "phonetree.zip" Global $sFileAddName=@ScriptDir & "phonetree.csv" Global $sDestDir="" Global $iFlag=77 ;create the phonetree.zip $r = _Zip_Create($sFileName, $iOverwrite) ConsoleWrite(@error & " : " & $r & @CRLF) ;Then to add phonetree.csv to the zip $r = _Zip_AddItem($sZipFile, $sFileAddName, $sDestDir, $iFlag) ConsoleWrite(@error & " : " & $r & @CRLF) Once i fixed that, it now creates & inserts the file.. Didn't even realize that, till just now... Might want to add that to the header, so others don't try to do that.. Edited September 3, 2010 by bb01
trancexx Posted September 3, 2010 Posted September 3, 2010 That's wrong. If that's the solution then it's a bug situation. wraithdu will fix that, don't worry. It's probably some regexp pattern. ♡♡♡ . eMyvnE
wraithdu Posted September 3, 2010 Author Posted September 3, 2010 (edited) @bb01 You are wrong on many levels, sorry. 1 - Your code is wrong. Print out the paths you've created above and see what they look like. You need the \ before the file names. 2 - Your original code was the source of the problem, and you would have easily figured it out if you looked at the returns and error codes from my functions. You used "\phonetree.zip" as the name of the zip file. Did you bother to look where that file was created? On my system, it was not in the script directory. Therefore your call to AddItem passed an invalid path, and an error code of 7 was returned -> 'Destination ZIP file does not exist' Edited September 3, 2010 by wraithdu
bb01 Posted September 3, 2010 Posted September 3, 2010 (edited) when i had "\phonetree.zip" it would create a blank phonetree.zip However when i took away the "\" It then would create the "phonetree.zip" with the phonetree.csv inside it using this script:- #include <_Zip.au3> Global $sFileName=@ScriptDir & "\phonetree.zip" Global $iOverwrite=1 Global $sZipFile=@ScriptDir & "\phonetree.zip" Global $sFileAddName=@ScriptDir & "\phonetree.csv" Global $sDestDir="" Global $iFlag=77 ;create the phonetree.zip $r = _Zip_Create($sFileName, $iOverwrite) ConsoleWrite(@error & " : " & $r & @CRLF) ;Then to add phonetree.csv to the zip $r = _Zip_AddItem($sZipFile, $sFileAddName, $sDestDir, $iFlag) ConsoleWrite(@error & " : " & $r & @CRLF) I get in the console:- >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\testing.au3" 0 : C:\\phonetree.zip 7 : 0 >Exit code: 0 Time: 0.336 But if i take out the "\" So the script looks like #include <_Zip.au3> Global $sFileName=@ScriptDir & "phonetree.zip" Global $iOverwrite=1 Global $sZipFile=@ScriptDir & "phonetree.zip" Global $sFileAddName=@ScriptDir & "phonetree.csv" Global $sDestDir="\" Global $iFlag=77 ;create the phonetree.zip $r = _Zip_Create($sFileName, $iOverwrite) ConsoleWrite(@error & " : " & $r & @CRLF) ;Then to add phonetree.csv to the zip $r = _Zip_AddItem($sZipFile, $sFileAddName, $sDestDir, $iFlag) ConsoleWrite(@error & " : " & $r & @CRLF) then i get phonetree.zip with phonetree.csv inside it. & the console shows:- >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\testing.au3" 0 : C:\phonetree.zip 0 : 1 >Exit code: 0 Time: 0.552 Edited September 3, 2010 by bb01
wraithdu Posted September 3, 2010 Author Posted September 3, 2010 Ok, that's why it's weird. Try not to run anything from the root drive. AutoIt @ScriptDir macro is inconsistent in this case. When in the root, @ScriptDir expands to 'X:\' with the trailing \. In any other directory, it expands to 'X:\some\dir' WITHOUT a trailing \. This is something YOU as a scripter have to be aware of, I cannot test for and fix that error.
TheSaint Posted September 5, 2010 Posted September 5, 2010 And if you don't believe or understand wraithdu, then check the Help file - which in your case is probably mandatory reading at this point! (i.e. you'll gain more understanding of what you are doing, which currently is pretty basic errors)Another recommendation for troubleshooting, is to use the occasional, prudent & temporary Msgbox to check on values for variables ... especially for paths. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
Skysnake Posted September 6, 2010 Posted September 6, 2010 I have no idea how you got a copy of the UDF with 'Local $' in it. The ones I have posted / updated do not have such errors. Get the updated copy anyway. And remove the UDF from your post above, it's large and unnecessary.AwesomeSkysnake Skysnake Why is the snake in the sky?
bb01 Posted September 13, 2010 Posted September 13, 2010 i wasnt saying wraithdu was wrong, i was trying to state that no matter how i did it, it just would not work right.. now that i've moved the folder & files it's working fine.. However i needed to do it, so that it would run at the root, as the network its on is the root dir. Anyway thanks for the help guys. & wraithdu it does work perfectly now.. Thank you.
cobra11 Posted September 14, 2010 Posted September 14, 2010 (edited) ... Edited December 6, 2017 by cobra11
wraithdu Posted September 14, 2010 Author Posted September 14, 2010 Your post is pretty useless. All I can say is I don't get that error, at all. You're going to need to post some reproducible code with specific instructions.
ACalcutt Posted October 23, 2010 Posted October 23, 2010 (edited) Has anybody had issues with _Zip_UnzipAll when "Hide extensions for known file types" is enabled in explorer? It was unzipping the files fine, but I kept getting the failure to extract error. I found out it was because the check if the file exists was returning 0 (this line) If FileExists($sDestPath & "\" & $oNS.Items.Item($oNS.Items.Count - 1).Name) Then From what i could see when you have "Hide extensions for known file types" enabled it only was returning "Uninstall" instead of "Uninstall.exe" To fix this temporarily I am getting the filename out out of the path instead (like this) $testfilesourcepath = $oNS.Items.Item($oNS.Items.Count - 1).path $testfiledestpath = $sDestPath & "\" & StringTrimLeft($testfilesourcepath, StringInStr($testfilesourcepath, "\" , 0 , -1)) If FileExists($testfiledestpath) Then Edited October 23, 2010 by ACalcutt Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature
wraithdu Posted October 25, 2010 Author Posted October 25, 2010 Interesting find... hooray for the Windows shell :/
Dryden Posted October 27, 2010 Posted October 27, 2010 Nice one... I'm glad someone decided to solve that $CmdLine bug in the original UDF. but... i have a problem... I was using the original zip UDF and to add all files inside a folder I used _Zip_AddFolder, but this option is no longer available in your version, instead I have the option _Zip_AddItem, the probem with this is that with _Zip_AddFolder I can add all the files inside a folder without adding the folder itself but with _Zip_AddItem the folder is added too... Any Ideas on how to solve this? What I want is to add all files inside a folder without adding the folder itself. "Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.
wraithdu Posted October 27, 2010 Author Posted October 27, 2010 (edited) You'll need to loop through your source files and add them individually to the new archive. The UDF does not support adding the contents of a folder. Please read the UDF header for my explanation (a good place to start anyway). Edited October 27, 2010 by wraithdu
Spiff59 Posted December 2, 2010 Posted December 2, 2010 Won't the dll accept network paths, such as "\\server\..."? If so, can you change _IsFullPath() to accept remote paths?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now