Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About downloading files on the network disk
#1
Hello everyone, if I can get the direct download address of the file, I use the following QM code, but for some files on the network hard disk, I have two problems:

1. I can't get the direct download address. When I click the download button, I can get the download link, At different times, the download link address is different. and the download address is changed. Test the network disk download link: https://sendit.cloud/vjhlvevk3ky3

2. The downloaded file may be incomplete due to network problems. I need to make sure the downloaded file is complete.How check the downloaded file is complete?  Huh

I hope someone can provide some suggestions and methods, thanks in advance. Smile


Macro Macro4
Code:
Copy      Help
str localfile="$desktop$\quickmac.ex_"
IntGetFile "http://www.quickmacros.com/quickmac.exe" localfile 16 0 1
ren- localfile "$desktop$\quickmac.exe"
#2
i have tried before and never found a reliable way to download files from file hosting sites that don't offer direct downloads
#3
I tried the code below but can't open the URL from IE Huh


Macro Macro4
Code:
Copy      Help
SHDocVw.IWebBrowser2 wb=web("https://sendit.cloud/vjhlvevk3ky3" 1)

MSHTML.IHTMLElement el=htm("INPUT" "id" "" "Internet Explorer" 0 0 0x221)
el.click

I found the following VBS code, I hope someone can help me improve it. Smile


Code:
Copy      Help
Dim btn,ie
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.Visible = true    
ie.navigate "http://webpage.com"
Do
Wscript.Sleep 200
Loop Until ie.readyState = 4  
Set btn =ie.Document.getElementById("J_SubmitQuick")
btn.click
#4
this is working for me in chrome
make sure
     
is checked in qm options window

Code:
Copy      Help
run "$program files$\Google\Chrome\Application\chrome.exe" "https://sendit.cloud/vjhlvevk3ky3"
int w1=wait(30 WV win("" "Chrome_WidgetWin_1"))
Acc a.Find(w1 "PUSHBUTTON" "" "a:id=btn_download" 0x3005 30)
a.DoDefaultAction
#5
Can I use IE browser? Because some computers don't have Google Chrome installed.

My idea is: use IE browser, hide the IE window to run Idea
#6
It's just not reliable .Internet explorer is an old outdated browser that really should not be used if at all possible.
#7
My usual order of operations is to use browser dialog to log in which will give QM access to the site if credentials are needed. Then IntGetFile to grab the page’s HTML. Then use findrx to parse out the link. Then IntGetFile to download the link.

These things can get tricky though, especially if JavaScript is being used for user interaction to interface with server side programming. It might take lots of reverse engineering to get a good link.

Sometimes I have to do what I call the GUI hack where I automate everything in the browser control. This is always my last resort because so many things can go wrong. Mostly timing while pages load. You also end up with Save As, File Exists, etc windows dialogs that need to be automated. Wait for window active is necessary to control timing.
#8
@TheVig

Thank you for sharing your experience.

I am currently experiencing two problems. I hope someone can provide some suggestions. Thanks in advance:



1. Because I open IE directly, it is not always effective, so I created a dialog box and built-in IE browser control, but my code can't run.


2. If you use the account password to log in to the network disk, it will save the cookie, how to clear the cookie after getting the link.

Macro Macro3

Code:
Copy      Help
qm_web ;;Function Custom Dialog Built-in IE Browser Control

;Click the download button in the dialog
int w=wait(3 WV win("Dialog" "#32770"))
Acc a.Find(w "LINK" "Download" "" 0x3001 3)
a.DoDefaultAction

;Clean up the cookie code
Function qm_web

Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 400 222 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 400 222 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD="http://quickmacros.com/"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#9
How to make the code of behind , operate the Front window  in the sub-process Huh





Macro Macro3
Code:
Copy      Help
mac sub.ie

;Click the download button in the dialog
int w=wait(3 WV win("Dialog" "#32770"))
Acc a.Find(w "LINK" "Download" "" 0x3001 3)
a.DoDefaultAction

;Clean up the cookie code

#sub ie

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 400 222 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 400 222 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD="http://quickmacros.com/"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#10
#1 your using mac incorrectly
 to call a sub-function using mac 
should be mac "sub.ie"

better probably would be something like this

Macro Macro300
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 400 222 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 400 222 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,mac "sub.WaitForLoaded" "" hDlg
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub WaitForLoaded
function hDlg
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))
we3.Navigate("http://www.quickmacros.com/download.html")
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
int w=wait(30 WV win("Dialog" "#32770"))
Acc a.Find(w "LINK" "Download" "value=http://www.quickmacros.com/quickmac.exe" 0x2005 3)
a.DoDefaultAction
#11
Thanks for your help, I added some code and can't continue to run, I have tried the function acc and send the key Huh


Macro Macro6
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 400 222 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 400 222 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,mac "sub.WaitForLoaded" "" hDlg
,mac "sub.con1"
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub WaitForLoaded
function hDlg
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))
we3.Navigate("http://www.quickmacros.com/download.html")
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
int w=wait(30 WV win("Dialog" "#32770"))
Acc a.Find(w "LINK" "Download" "value=http://www.quickmacros.com/quickmac.exe" 0x2005 3)
a.DoDefaultAction

#sub con1

int w3=wait(30 WA win(" - " "#32770"))

key As

key As

int w4=win("" "#32770")
clo w4

int w2=win("Dialog" "#32770")
clo w2
#12
not completely sure what your trying to do with your code
#13
Use a custom dialog with IE controls to simulate a manual click of a button to download a file Smile

Running is always unsuccessful, I don't know where I encountered the error
#14
try this

Macro Macro301
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 400 222 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 400 222 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,mac "sub.WaitForLoaded" "" hDlg
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub WaitForLoaded
function hDlg
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))
we3.Navigate("http://www.quickmacros.com/download.html")
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
30 WV hDlg
;can use acc here
Acc a.Find(hDlg "LINK" "Download" "value=http://www.quickmacros.com/quickmac.exe" 0x2005 3)
a.DoDefaultAction
;or can use htm instead both work speed about the same
;Htm e=htm("B" "Download" "" hDlg "0" 1 0x1 30)
;e.Click
int w=wait(0 WA win("File Download - Security Warning" "#32770"))
act w
0.5
but id(4427 w)
int w1=wait(0 WA win("Save As" "#32770"))
but id(1 w1)
int w2=wait(0 WA win("Download complete" "#32770"))
but id(2 w2)
clo hDlg
#15
Thanks, I can run successfully after I modify the title bar text. Smile

Different language operating systems, waiting for the text on the title bar of the window is different, can I use wildcards? The following code is not successful

int w=wait(0 WA win(" - " "#32770"))
act w
0.5
but id(4427 w)
int w1=wait(0 WA win("?" "#32770"))
but id(1 w1)
int w2=wait(0 WA win("?" "#32770"))
but id(2 w2)
clo hDlg

I still have a problem, if the network disk needs to use the account password to log in, it will log the login system, there is a function to clear the login information?  Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)