Sign in to follow this  
Followers 0
Truong

WINHTPP.au3 and ZIP.au3 questions

22 posts in this topic

Greetings,

I have two questions :graduated:, and I'm expecting some helps ^^

1) I've searched and read the forum about WINHTTP.au3, but all the examples are not completed, none of them could work fluently! So I'm asking if you guys could make an example of how to use it, to log in to Auto it forum for instance, or search google. Please maintain the UDF download link you're using :(

2) I've used the ZIP.au3 UDF. I can successfully create new ZIP file, but when I extract them, it says "Error copying File or Folder - The File Exists"

This code is used to make file ZIP. It worked!

;REQUIRE: _ZIP.au3

#include <_zip.au3>
#Include <Crypt.au3>


$zipPath=@ScriptDir&"\dataTemp.zip";
$desPath=@ScriptDir&"\data";
;MsgBox(0,"", "Extract "&$zipPath&" to folder "&$desPath);
$ss=_Zip_Unzip($zipPath, "bg.jpg", $desPath, 1);
;MsgBox(0,"",$ss);
;MsgBox(0,"",@error);

This code is used to extract the ZIP file made above, it does not work :-(

;REQUIRE: _ZIP.au3

#include <_zip.au3>
#Include <Crypt.au3>


$zipPath=@ScriptDir&"\dataTemp.zip";
$desPath=@ScriptDir&"\data";
;MsgBox(0,"", "Extract "&$zipPath&" to folder "&$desPath);
$ss=_Zip_Unzip($zipPath, "bg.jpg", $desPath, 1);

Here is the link of zip.au3 UDF:

I also attach all files that I use for the script. Please download and correct it for me!

And that's all.

Any reply is appreciated!

dataCoder.au3

Copy of trial.au3

_Zip.au3

post-60590-0-19751500-1290741943_thumb.j

post-60590-0-60686100-1290741951_thumb.g


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Truong,

I cannot help with the HTTP question, but in respect of the ZIP query - why are you still using torel's UDF? :graduated:

wraithdu has completely rewritten it (as he mentions a couple of posts above yours in the topic :D ) and his version is much better. Why not try the new UDF which you can find here - you may find it solves your problem. :(

M23

Edit: Typnig!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Melba23, thanks for your advice. I didn't notice that. Now I get it :graduated:.

Oh but wait, when I run the script, it still prompts the same message: "Error copying File or Folder-The File Exists" and return @Error=0 which is not mentioned in the error list >.<!

I still have the question above, could anyone please figure it out for me :(

Edited by Truong

http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi, the WinHTTP-UDF is here:

Homepage: http://winhttp.origo.ethz.ch/wiki/winhttp

Thread:

In my opinion, there a enough good examples in the download and the helpfile.

Edit: Just a quote from Microsoft:

A basic understanding of the HTTP protocol is important to use either [WinHTTP or WinInet] interface.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Hi, the WinHTTP-UDF is here:

Homepage: http://winhttp.origo.ethz.ch/wiki/winhttp

Thread:

In my opinion, there a enough good examples in the download and the helpfile.

Edit: Just a quote from Microsoft:

Thank dude, now I figure it out.

How about the ZIP.au3 error? Could anyone solve it for me :graduated:


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

Truong,

This code zips both the images you posted and then extracts the .jpg image into a new folder. It uses wraithdu's UDF: :(

#include "zip.au3"

$sZipFile = _Zip_Create(@ScriptDir & "\Zipper.zip", 1)
ConsoleWrite($sZipFile & @CRLF)

If _Zip_AddItem($sZipFile, @ScriptDir & "\bg.jpg", "", 1) = 0 Then
    ConsoleWrite(@error & @CRLF)
Else
    ConsoleWrite("OK 1" & @CRLF)
EndIf
If _Zip_AddItem($sZipFile, @ScriptDir & "\transparent.gif", "", 1) = 0 Then
    ConsoleWrite(@error & @CRLF)
Else
    ConsoleWrite("OK 2" & @CRLF)
EndIf

If _Zip_Unzip($sZipFile, "pic1.jpg", @ScriptDir & "\Data") = 0 Then
    ConsoleWrite(@error & @CRLF)
Else
    ConsoleWrite("OK Extract" & @CRLF)
EndIf

Does it work for you? :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Truong,

This code zips both the images you posted and then extracts the .jpg image into a new folder. It uses wraithdu's UDF: :(

#include "zip.au3"

$sZipFile = _Zip_Create(@ScriptDir & "\Zipper.zip", 1)
ConsoleWrite($sZipFile & @CRLF)

If _Zip_AddItem($sZipFile, @ScriptDir & "\bg.jpg", "", 1) = 0 Then
    ConsoleWrite(@error & @CRLF)
Else
    ConsoleWrite("OK 1" & @CRLF)
EndIf
If _Zip_AddItem($sZipFile, @ScriptDir & "\transparent.gif", "", 1) = 0 Then
    ConsoleWrite(@error & @CRLF)
Else
    ConsoleWrite("OK 2" & @CRLF)
EndIf

If _Zip_Unzip($sZipFile, "pic1.jpg", @ScriptDir & "\Data") = 0 Then
    ConsoleWrite(@error & @CRLF)
Else
    ConsoleWrite("OK Extract" & @CRLF)
EndIf

Does it work for you? :graduated:

M23

It works for the Creating zip file, but then the _Zip_unzip() does not work, just like the original problem! Does it work for you?

Ah btw, this question maybe not belong to this topic, I consider it is not an important question to make a new topic so maybe I'll ask here: How can you move the focus from somewhere to the input. For example I have an input $input, and then I HotKeySet("^m","focus") and I want to move the focus to that input:D


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

Does it work for you?

Of course - or I would not have posted it! :(

Do you have the correct permission to create a file or folder where you are trying to do so? :graduated:

As to the new question, try this: :D

#include <GUIConstantsEx.au3>

HotKeySet("^m","_Focus")

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("fred", 10, 10, 200, 20)

$hButton = GUICtrlCreateButton("Dummy", 10, 50, 80, 30)
GUICtrlSetState(-1, $GUI_FOCUS)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Focus()
    GUICtrlSetState($hInput, $GUI_FOCUS)
EndFunc

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Of course - or I would not have posted it! :(

Do you have the correct permission to create a file or folder where you are trying to do so? :graduated:

As to the new question, try this: :D

#include <GUIConstantsEx.au3>

HotKeySet("^m","_Focus")

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("fred", 10, 10, 200, 20)

$hButton = GUICtrlCreateButton("Dummy", 10, 50, 80, 30)
GUICtrlSetState(-1, $GUI_FOCUS)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Focus()
    GUICtrlSetState($hInput, $GUI_FOCUS)
EndFunc

M23

Yes the small question is worked thanks to you M23, but the ZIP code still does not work, do you need a short video clip of my screen??

http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

Here is the video of what happened!

http://dl.dropbox.com/u/10790285/OnlineUsed/autoit_proof.avi


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

Truong,

If you are using this code to read the error, you will not get the value you require as @error will have been reset to the error value of the first MsgBox command - which is almost certainly 0: :(

$ss=_Zip_Unzip($zipPath, "bg.jpg", $desPath, 1);
MsgBox(0,"",$ss);
MsgBox(0,"",@error);

You need something like this:

$ss = _Zip_Unzip($zipPath, "bg.jpg", $desPath, 1);
$iError = @error
MsgBox(0, "", $ss & @CRLF & $ierror);

Now what error do you actually get? :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Now my error is 10: Failed to extract file :-(, what happen to it?

Thanks for helping me to figure out the error M23 :graduated:


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

Truong,

Are you certain that the paths you are using for the zipfile and the destination are correct? :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Truong,

Are you certain that the paths you are using for the zipfile and the destination are correct? :graduated:

M23

M23,

Hi I have attached the files and even give you the video clip of what happen, could you please check it out for me?

About the path, I'm 100% sure that I used the full right path @Scriptdir&"\dataTamp.zip"!

Edited by Truong

http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

Truong,

Hi I have attached the files and even give you the video clip of what happen, could you please check it out for me?

I checked out your code and images in post #6 above. :(

When I use your code (slightly adapted for wraithdu's UDF) and your images, I have no problems at all - the images go into the zip and are extracted to a new folder without error.

I am afraid I can help no more - I can see no reason why the code I posted above should fail for you. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Truong,

I checked out your code and images in post #6 above. :D

When I use your code (slightly adapted for wraithdu's UDF) and your images, I have no problems at all - the images go into the zip and are extracted to a new folder without error.

I am afraid I can help no more - I can see no reason why the code I posted above should fail for you. :(

M23

M23,

I very appreciate your help :graduated:, it's ok, I think that It must be something wrong with my computer. But can I ask for one more favor? Do you know any other way to make multiple files be 1 file, and extract them to files just like winzip, but it does not need to be winzip, any other tricks?


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

You could use 7zip. There is a UDF for the 7zip.dll, so you don't need an extra exe.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

It's weird that even 7zip udf does not work for me, it always returns value 0!


http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
Share on other sites

If you have an x64 OS, then you have to make sure you run AutoIt in 32bit (x86) mode since the DLL is not available for 64bit.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

If you have an x64 OS, then you have to make sure you run AutoIt in 32bit (x86) mode since the DLL is not available for 64bit.

I'm using Windows XP :-(, is there any other tricks to combine files to 1 file? That's all I need :graduated:

http://www.facebook.com/xx3004?sk=info

Share this post


Link to post
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
Sign in to follow this  
Followers 0