Discussion:
How do I use an API function with vbs?
(too old to reply)
GS
2014-03-24 02:37:38 UTC
Permalink
I'm trying to run a script that uses the *URLDownloadToFile* function
in urlmon.dll. It doesn't want to work same as in VB[A] for some
reason, and so how do I get it to work in VBS?
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Mayayana
2014-03-24 03:07:06 UTC
Permalink
"GS" <***@somewhere.net> wrote in message news:lgo5pj$ge6$***@dont-email.me...
| I'm trying to run a script that uses the *URLDownloadToFile* function
| in urlmon.dll. It doesn't want to work same as in VB[A] for some
| reason, and so how do I get it to work in VBS?
|

You can't use API calls in VBS. It's interpreted.
There's no access to memory addresses, there's
no way to load a library, and in general you can't
use functions with datatypes other than variant.
You can only use late-bound COM objects, accessed
via CreateObject.

Your options would be to use IE, or to find/write
an ActiveX DLL or EXE to do the job, or write a
small EXE that the VBS can call.
GS
2014-03-24 03:11:12 UTC
Permalink
Post by Mayayana
Post by GS
I'm trying to run a script that uses the *URLDownloadToFile*
function in urlmon.dll. It doesn't want to work same as in VB[A] for
some reason, and so how do I get it to work in VBS?
You can't use API calls in VBS. It's interpreted.
There's no access to memory addresses, there's
no way to load a library, and in general you can't
use functions with datatypes other than variant.
You can only use late-bound COM objects, accessed
via CreateObject.
Your options would be to use IE, or to find/write
an ActiveX DLL or EXE to do the job, or write a
small EXE that the VBS can call.
Ok, thanks! I found out as mush already but was hoping for a
workaround. I went the EXE route and just execute.

Is there any way vbs can download files from a url?
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Evertjan.
2014-03-24 08:25:46 UTC
Permalink
Post by GS
Is there any way vbs can download files from a url?
[Please start a new thread for a new Q, usenet is not email.]

http://stackoverflow.com/questions/2973136/download-a-file-with-vbs
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
GS
2014-03-24 16:05:07 UTC
Permalink
Post by Evertjan.
Post by GS
Is there any way vbs can download files from a url?
[Please start a new thread for a new Q, usenet is not email.]
http://stackoverflow.com/questions/2973136/download-a-file-with-vbs
Thanks for the link! I already found this along with several other
examples. I did choose this one to adapt to my needs and so good choice
on your about.

Sorry about OT Q, my bad!

P.S.
You need to get off that "not email" kick!
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Mayayana
2014-03-24 13:25:36 UTC
Permalink
|
| Ok, thanks! I found out as mush already but was hoping for a
| workaround. I went the EXE route and just execute.
|
| Is there any way vbs can download files from a url?
|


Evertjan's method using msxml and msado looks good.
Presumably those are installed on all systems. I've never
tried it. You can also automate IE, but that's sloppy
and may run into security issues. Other than that, VBS
can do just about anything, but not by itself. If this is
in your installer then I assume you can't be registering
ActiveX. I'm curious: What is the installer system you're
using?
GS
2014-03-24 15:59:43 UTC
Permalink
Post by Mayayana
Post by GS
Ok, thanks! I found out as mush already but was hoping for a
workaround. I went the EXE route and just execute.
Is there any way vbs can download files from a url?
Evertjan's method using msxml and msado looks good.
Presumably those are installed on all systems. I've never
tried it.
Seems that msxml/msado are/is the way to go as I found many adaptable
examples just googling. I'm playing around with what I found but will
also look at Evertjan's reply...
Post by Mayayana
You can also automate IE, but that's sloppy
and may run into security issues. Other than that, VBS
can do just about anything, but not by itself. If this is
in your installer then I assume you can't be registering
ActiveX.
I run everything reg-free and so registering ActiveX components is not
an option for me.
Post by Mayayana
I'm curious: What is the installer system you're using?
InstallMate9
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Loading...