Jump to content
Macro Express Forums

Download A File From Http - Resolved


Recommended Posts



I have a series of files that I need to download regularly. They sit on a sharepoint server. (FTP not an option)


I have used Macro express a lot in the past with FTP downloads, and thought it could do what I need now... However I can't seem to make it work.


What I am trying to do is the following:


File is published to a sharepoint website... for example:


http://server/custom report files/0705/1234.xls


Where 0705 = month of the report

where 1234.xls = the file I want to download, named after the account number.


I just can't seem to simply download 1234.xls without opening the browser. (Even when I do open the browser, it seems to take on different actions that I can't control Ie: 1 time it opens it in a brownser, the next , right in excel)


So my question is this...


Is there a way I can tell macro express to go download the file 1234.xls if I identify it's path ?


I almost want to mimic the action of right -clicking and selecting "save target as", but without having to actually right click.


How can I do so ?


Thanks everyone.




I went to another software package to do the downloading for me. Thanks

Link to comment
Share on other sites



I'm confused by your comment...

I almost want to mimic the action of right -clicking and selecting "save target as", but without having to actually right click.


If you "almost" want to, then have the macro do that. I save and do many functions in a number of different programs by having the macro do a right click and then arrow down to the action on the drop down I want taken and hit enter/numenter, and then have the macro do each succeeding action till the file is saved, even where I want it.


If this isn't helpful, maybe you can clarify.

Link to comment
Share on other sites

I can't actually right click, because there is no way to know where the cursor would have to be placed to do the right click.


The reason I referenced "right Click" was that I wanted to save the file, and the easiest way of saving a file from a website is to right click the link and choose "save target as"... sorry if it was confusing.


No matter, I found a solution to my problem.


After spending countless hours trying, I determined that ME cannot do what I wanted. Maybe a suggestion for future enhancement...


Allow downloading thru HTTP in addition to FTP.



Link to comment
Share on other sites

Here's a macro that downloads a file using HTTP.

// Sample: Download a file via http
// ----------------------------------------------------------------------
// Uses
//   D1  - Short delay time
//   T9  - Path name to save the file

// Initialization
Variable Set Decimal %D1% to 1.0
Variable Set String %T9% "e:\Temp\zpex.exe"

// Remove file if it already exists to avoid the 'Replace It' dialog
If File Exists "zpex.exe"
 Delete File or Files: "%T9%"
End If

// Download a file
Web Site: http://www.wintools.com/download/zpex.exe [Default Browser]
Delay %D1% Seconds
Wait For Window Title: "Opening"
Delay %D1% Seconds
If Not Window Title "Opening" on top
 Activate Window: "Opening"
End If
Text Type: <ENTER>
Delay %D1% Seconds
Text Type: %T9%<ENTER>

With this macro you need to know the name of the file to download. There are techniques to read the filename from a web page. You can save the web page into a temporary file and then parse through the file to find the filenames.

Link to comment
Share on other sites

Thanks Kevin, that was actually a really nice script, but didn't do the trick. My file is *.xls, so it just opens the file up in the browser. I could change the browswer settings I guess, but that would interrupt some other things I need to do to.


Maybe if I install another browser to run this process ...hmmm...


Either way, thanks, I did pick up a few ideas from your script though. This program is a lot better than it was a few years ago.

Link to comment
Share on other sites

I could change the browswer settings I guess, but ...
Macro Express can make adjustments to the registry. It is likely that the setting to download vs view an .xls file is in saved in the registry you may be able to change the setting, run the macro, and restore the settings.
Link to comment
Share on other sites

I'm running IE. As I said, sometime it load excel in the browser, other times it prompts for what to do. Maybe if I installed Firefox it might always ask... BUT


It doesn't matter, I've found a program to do the actual downloading for me and it works better than I thought it would (And much simpler than what we're talking about here). So I have ME launch the download program, ME loads the parameters, the software downloads the files, then back to ME to process the files (move, rename etc).


My next questions will be surrounding the tracking of these files and what was done / not done etc.


But I'll try and tackle it first on my own.


Thanks for your help everyone.

Link to comment
Share on other sites

  • 3 weeks later...

Is there ANY way to download a file directly with Macro Express? I would think that ME would have the ability built in, but I guess not. I wish the OP would have stated which program they used to download their file. :D Besides, since the only macro posted is for exe's only, I am not sure if this thread should be set to "Resolved."

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...