Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IntGetFile from URL generated by Server script.
#1
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 part...so here's my explanation.

Here's the code that works:
Function Function68
Code:
Copy      Help
out
int Number=2182804
str ID="30R10080"
rep 9
,_i+1
,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
,Number+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:
javascript:tS('g2209232')
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:
http://xxxxxxxxx.asp?WCI=thingstodo&WCE=Action

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.

Thanks,
jimmy Vig
#2
I think you will need to automate browser. I don't know other ways to execute the javascript.
#3
Gintaras,

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.

Thanks,
Jimmy Vig
#4
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.
#5
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?

Thanks,
Jimmy Vig
#6
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.
#7
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
#8
Function Dialog82
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str ax3SHD
ax3SHD="www.quickmacros.com/forum"
hDlg=ShowDialog("Dialog82" &Dialog82 &controls 0 1)
opt waitmsg 1
wait 0 -WC hDlg

;to make invisible, change 0x90C800C8 to 0x80C800C8

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

ret
;messages
SHDocVw.WebBrowser we3
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Macro Macro1285
Code:
Copy      Help
int w1=win("Dialog82" "#32770")
if(!w1)
,mac "Dialog82"
,1
,w1=win("Dialog82" "#32770")

Htm el=htm("A" "Programming" "" w1 0 0 0 20)
el.Click
el=htm("A" "IntGetFile" "" w1 0 0 0 10)
el.Click
#9
I'm having troubles figuring out how to get the HTML from the final page. I know it's gotta be simple...
#10
str html=el.DocText(1)
#11
Oh...I think I figured it out.
#12
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
#13
This website is giving me troubles:
"http://graveline.com/features"

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

The parent page of "features" is "http://graveline.com/downloads"

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

Doesn't work.

Thanks,
jimmy Vig
#14
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.
#15
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!
Thanks
jimmy Vig


Forum Jump:


Users browsing this thread: 1 Guest(s)