marinko22 Posted May 28, 2020 Share Posted May 28, 2020 (edited) Hello everybody, I'm new to AUTOIT and forum and sorry if this is a stupid question. I'd like to automatically every day download a specific file from website, but the name of the file is changing. - website: https://www.zaba.hr/home/tecajna - File: <a class="action-download" href="/home/ZabaUtilsWeb/utils/tecaj/txt/103/2020"><span>TXT</span></a> - Number "103" increases every day by one. - downloaded file: tecajna-103-2020.txt Can you guys help me please. Thank very much. Edited June 2, 2020 by marinko22 Link to comment Share on other sites More sharing options...
Nine Posted May 28, 2020 Share Posted May 28, 2020 To start you up : #include <IE.au3> #include <Constants.au3> Local $oIE = _IECreate("https://www.zaba.hr/home/tecajna") If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Unable to load web page") Local $oDL = _IEGetObjById ($oIE, "txt") If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","TXT Object not found") $oDL = _IETagNameGetCollection($oDL, "a", 0) If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","DownLoad Object not found") _IEAction ($oDL, "click") Sleep (2000) Local $hWnd= _IEPropertyGet ($oIE, "hwnd") Local $hCtrl = ControlGetHandle ($hWnd, "", "DirectUIHWND1") ControlSend ($hWnd, "", $hCtrl, "{F6}{TAB}") Sleep (800) ControlSend ($hWnd, "", $hCtrl, "{ENTER}") marinko22 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Marc Posted May 28, 2020 Share Posted May 28, 2020 Or something like #include <Inet.au3> $x = _INetGetSource("https://www.zaba.hr/home/tecajna") $pos = StringInStr($x, "/home/ZabaUtilsWeb/utils/tecaj/txt/") $file = StringMid($x, $pos+35,8) InetGet("https://www.zaba.hr/ZabaUtilsWeb/utils/tecaj/txt/" & $file, StringReplace($file, "/", "-") & ".txt") marinko22 1 Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) Link to comment Share on other sites More sharing options...
marinko22 Posted May 28, 2020 Author Share Posted May 28, 2020 Works like a charm Thank you both very much Link to comment Share on other sites More sharing options...
marinko22 Posted May 28, 2020 Author Share Posted May 28, 2020 InetGet("https://www.zaba.hr/ZabaUtilsWeb/utils/tecaj/txt/" & $file, StringReplace($file, "/", "-") & ".txt") can you tell me how to define where to download a file Link to comment Share on other sites More sharing options...
Developers Jos Posted May 28, 2020 Developers Share Posted May 28, 2020 1 minute ago, marinko22 said: can you tell me how to define where to download a file F1 in SciTE to open the Helpfile? marinko22 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
water Posted May 28, 2020 Share Posted May 28, 2020 The help file is your friend marinko22 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
marinko22 Posted May 28, 2020 Author Share Posted May 28, 2020 InetGet("https://www.zaba.hr/ZabaUtilsWeb/utils/tecaj/txt/" & $file, "\\c\test\" & StringReplace($file, "/", "-") & ".txt") or #include <Inet.au3> Local $sFilePath = "\\c\test\" $x = _INetGetSource("https://www.zaba.hr/home/tecajna") $pos = StringInStr($x, "/home/ZabaUtilsWeb/utils/tecaj/txt/") $file = StringMid($x, $pos+35,8) Local $hDownload = InetGet("https://www.zaba.hr/ZabaUtilsWeb/utils/tecaj/txt/" & $file, $sFilePath & StringReplace($file, "/", "-") & ".txt") what do you think is better Link to comment Share on other sites More sharing options...
Nine Posted May 28, 2020 Share Posted May 28, 2020 Both are good. Having a separate $sFilePath is useful if you need to refer to it often. marinko22 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
marinko22 Posted May 28, 2020 Author Share Posted May 28, 2020 thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now