Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IntGetFile from URL generated by Server script.
I'm not sure I'll be able express this very well or if I'll be able to get any help, but I'll give it a shot.

I need to download MP3 files from a website that posts new files every week. I've been trying to automate the process without just automating a web browser.

I've gotten pretty close. Actually I can do it, except for one here's my explanation.

Here's the code that works:
Function Function68
Copy      Help
int Number=2182804
str ID="30R10080"
rep 9
,str localfile.format("$desktop$\%s%i.mp3" ID _i)
,out localfile
,str s="http://xxxxxxx.asp?wci=download&hformstate_action=%i&hpackagenumber_session=%i&hformstate_session=04C63D7C-8294-4B55-97CD"
,_s.format(s Number Number)
,IntGetFile _s localfile 16 0 1

See, the Number variable and the ID variable change each week. The ID variable is coded by week and I have that number from a production order. The Number variable is some sort of counter variable used by the company. Since they handle a lot of changing accounts this number is essentially random, it does always increase...but by what? there's no way of predicting. Sometimes the files are not even sequential for a week.

What I need to do is be able to know what the Number value is based on the webpage html.
I can get the HTML for the page right before the page I need that contains the MP3 link information:
http://xxxxxxxxx.asp?wci=thingstodo&wce ... -4B55-97CD

From that URL I can get the html to get the link to the download page which is:
I'm not sure what can be done with the javascript?

So when I click on the javascript link the browser goes to the download page with the URL:

Of course it all works when going from the previous ?wci=thingstodo&wce=04C63D7C-8294-4B55-97CD page where it takes me to the right page with the MP3 downloads, but when I go at it from any other angle (like QM) it is just generic server URL that doesn't contain the HTML I am looking for the obtain the MP3 download link information.

It basically boils down to what can be done with that javascript link, if anything. I don't know enough about how webages work, and then how to work with them through QM to figure this out on my own. So like I said, I'm not sure if anyone can help me with this, especially since I don't want to post actually working data because this is a website I use for work. Possibly any point in the right direction might guide me to a solution.

jimmy Vig
I think you will need to automate browser. I don't know other ways to execute the javascript.

I was hoping you would have the magic solution here. If you think of anything please let me know. Maybe there is another angle I could approach this.

Jimmy Vig
Why cannot use browser? If because it shows file download dialog, maybe you can extract the download URL from browser and then download with IntGetFile.
I like to run things in the background and I don't know good methods to run these downloads from the browser without mouseclicks and other shananigans. Any examples that could help?

Jimmy Vig
Open the first web page in web browser control in hidden dialog. Or in hidden internet explorer.
Use html element functions to find and click links.
So use a QM browser. Gee, I hadn't thought of that. I was trying to figure out how to do it with Firefox and IE.

See, that's why I ask you these questions. You have much wisdom from experience I can only hope to gain through time.

Thanks Gintaras!
jimmy Vig
Function Dialog82
Copy      Help
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str ax3SHD
hDlg=ShowDialog("Dialog82" &Dialog82 &controls 0 1)
opt waitmsg 1
wait 0 -WC hDlg

;to make invisible, change 0x90C800C8 to 0x80C800C8

;0 "" 0x90C800C8 0x0 0 0 491 333 "Dialog82"
;3 ActiveX 0x54030000 0x0 0 0 492 332 "SHDocVw.WebBrowser"
;DIALOG EDITOR: "" 0x2030109 "*" "" ""

SHDocVw.WebBrowser we3
sel message
,case WM_COMMAND goto messages2
sel wParam
,case IDOK
ret 1

Macro Macro1285
Copy      Help
int w1=win("Dialog82" "#32770")
,mac "Dialog82"
,w1=win("Dialog82" "#32770")

Htm el=htm("A" "Programming" "" w1 0 0 0 20)
el=htm("A" "IntGetFile" "" w1 0 0 0 10)
I'm having troubles figuring out how to get the HTML from the final page. I know it's gotta be simple...
str html=el.DocText(1)
Oh...I think I figured it out.
This seemed very promising in my "Get Temperature" QM script but it seems the website I use changes too often now to be reliable. However, this is very clever and might prove useful elsewhere. Thanks Gintaras!
Matt B
This website is giving me troubles:

It has a password screen that isn't coming up in the QM browser control.

The parent page of "features" is ""

I even tried this:
Function IT_Features
Copy      Help
int w1=win("Mijo_DownLoad_MP3" "#32770")
,mac "GraveLine_MP3"
,w1=win("GraveLine_MP3" "#32770")
Htm el=htm("A" ">> CLICK HERE to download the Daily Features" "" win("Mijo_DownLoad_MP3" "#32770") 0 9 0x21)

Doesn't work.

jimmy Vig
It seems that the user/password dialog must be implemented by the app that hosts the control, but QM does not implement it. I also tested some other apps that have web browser control. The same. You will need IE.
Bummer. I wrote up the script to automate FireFox or IE. SendClickMessage is a pretty cool function and I wish I had found it sooner!
jimmy Vig

Forum Jump:

Users browsing this thread: 1 Guest(s)