Sign in to follow this  
Followers 0
ezzetabi

Function that opens a download dialog.

19 posts in this topic

In my computer it answers

"Your current security settings do not allow this file to be downloaded."

and I have no idea how to change for testing.

But YOU may like it. :)

$sFile = 'http://crimsonfan.altervista.org/run.zip'
$a = DllCall("shdocvw.dll",'int','DoFileDownload','string',$sFile)

Share this post


Link to post
Share on other sites



yeah, it seems to say that no matter what the file you're trying to download is... wierd


I have a catapult. Give me all the money or I will fling an enormous rock at your head.

Share this post


Link to post
Share on other sites

And as undocumented shdocvw func I do not know where seek info... :)

Share this post


Link to post
Share on other sites

hm, just found something that says that function needs the string in unicode, would have to use MultiByteToWideChar in kernel32 to convert it... starting to sound like a pain...


I have a catapult. Give me all the money or I will fling an enormous rock at your head.

Share this post


Link to post
Share on other sites

I am pretty sure I am close...

$url = 'http://crimsonfan.altervista.org/run.zip'

$ln = StringLen($url)
$space = ""

for $i = 0 to 3 * $ln
   $space = $space + " "
Next

$res = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 1, "long", "", "str_ptr", $url, "long", -1, "str_ptr", $space, "long", $ln, "long", "")
$a = DllCall("shdocvw.dll",'int','DoFileDownload','str',$res[5])

converted from this:

MultiByteStr$ = "http://david.oslb.net/index.htm" + chr$(0)
    CodePage = 1 ' CP_OEMCP
    chMultiByte = -1
    chWideChar = len(MultiByteStr$)
    WideCharStr$ = space$(3 * chWideChar)

    calldll #kernel32, "MultiByteToWideChar", _
        CodePage     as ulong, _
        Flags         as ulong, _
        MultiByteStr$ as ptr, _
        chMultiByte as ulong, _
        WideCharStr$ as ptr, _
        chWideChar    as ulong, _
        result        as ulong

    file$ = WideCharStr$

    Open "Shdocvw.dll" for dll as #shdocvw

    CallDLL #shdocvw, "DoFileDownload", _
        file$ as ptr,_
        ret as long

    Close #shdocvw
end

Who else would I be?

Share this post


Link to post
Share on other sites

1) What's str_ptr? All strings are pointers since they of integral type char*.

2) You are attempting to store a wchar_t in a char. What do you think the odds are of that working? Here's the output in the return array:

104 0 116 0 116 0 112 0 58 0 47 0 47 0 99 0 114 0 105 0 109 0 115 0 111 0 110 0 102 0 97 0 110 0 46 0 97 0 108 0

Thus, an h prints and thats it.

Share this post


Link to post
Share on other sites

Well, Valik, I am only trying to make it work. I have absolutely no idea what I am doing, which you have proved. Have you any better ideas on how to do the conversion?


Who else would I be?

Share this post


Link to post
Share on other sites

Use VBS, VB, C/C++, et cetera.

Share this post


Link to post
Share on other sites

Where is the fun?

Share this post


Link to post
Share on other sites

@Valik, Do I understand that autoit cannot even store such a value? If so, then it does look impossible.

@Python, it is not a mistake.

@ezzetabi, For the comments from python, he is used to a website called altavista.com Your url looks like a mistake to him, which it is not. For the part of the code, If Valik validates my assumption, then autoit will only be able to do this when autoit has full support for unicode. That, as we all know, is not going to happen soon.


Who else would I be?

Share this post


Link to post
Share on other sites

About BlackDiablo: oh yeah. I forgot the lack of his brain activity.

About the DllCall: Pity. Well, we already have InetGet() so it is not a problem at all.

Still, it is strange that a download Func accepts only unicode where internet addresses often don't.

:)Do you like the lastest version of Run!?

Share this post


Link to post
Share on other sites

That is correct, this-is-me, it's not currently possible to store a wide character correctly because AutoIt internally uses a multi-byte character.

Share this post


Link to post
Share on other sites

I didn't know it was a real website. I just looked at the name and it reminded me of www.googler.com. I don't know why.

Share this post


Link to post
Share on other sites

Jon, Since the new beta, the following should be possible:

$url = 'http://crimsonfan.altervista.org/run.zip'
$a = DllCall("shdocvw.dll", 'int', 'DoFileDownload', 'wstr', $url)

However, the error mentioned above (security settings) still occurs. Is something wrong with the code?


Who else would I be?

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Nothing happens here on Windows XP SP1. I even compiled it and nothing.

Never mind... I'm not using the latest version. I need to convert GUIRead to GUICtrlRead first...

Edited by SlimShady

Share this post


Link to post
Share on other sites

Well maybe Valik can get around to looking at it.


Who else would I be?

Share this post


Link to post
Share on other sites

Well maybe Valik can get around to looking at it.

<{POST_SNAPBACK}>

I have no idea why it doesn't work.

Share this post


Link to post
Share on other sites

Oh well. Jon? Larry?


Who else would I be?

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