12-13-2024, 03:55 PM
had some time to look at this again and found a workaround. It involves loading the web page in a hidden web browser control and then can download
Function Download403Image
Function Download403Image
if(!FileExists("C:\TEMP" 1))
,mkdir "TEMP" "C:"
if(FileExists("C:\TEMP\eps_apcpn_us_23.png"))
,del "C:\TEMP\eps_apcpn_us_23.png"
str dd=
;BEGIN DIALOG
;0 "" 0x90CA0AC8 0x0 0 0 710 470 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 710 470 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""
str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls 0 128)) 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
str d1.timeformat("{yyyyMMdd}00")
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))
we3.Navigate(F"https://www.tropicaltidbits.com/analysis/models/eps/{d1}/")
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
int w3=id(3 hDlg)
Htm e=htm("A" "eps_apcpn_us_23.png" "" w3 "0" 2530 0x1 3)
e.SetFocus
e.Click
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
str url=F"https://www.tropicaltidbits.com/analysis/models/eps/{d1}/eps_apcpn_us_23.png"
Htm e1=htm("IMG" url "" w3 "0" 0 0x921 3)
sub.Downloadimage(d1)
sub.WebBrowserMemoryLeakWorkaround(w3)
clo hDlg
#sub Downloadimage
function ~d2
str filepath.expandpath("C:\TEMP\eps_apcpn_us_23.png")
int i=URLDownloadToFile(0 F"https://www.tropicaltidbits.com/analysis/models/eps/{d2}/eps_apcpn_us_23.png" filepath 0 0)
run filepath
#sub WebBrowserMemoryLeakWorkaround
function hwndWB
SHDocVw.WebBrowser we3._getcontrol(hwndWB)
we3.Navigate("about:blank")
opt waitmsg 1
1 ;;minimal working time with YouTube was 0.3
DestroyWindow hwndWB
0.1