Diana (Cda) Posted August 14 Posted August 14 (edited) We reach tipping point sometimes. I use the "Open a specific page or set of pages" in my browser to open a set of pages on browser startup. But it's a serious pain to edit, however, and to keep maintained. And I'm finally just fed up with it despite the feature's value. I'd like to pare down the use of this function to strictly necessary pages, and get the bulk of extra URLs off into an AU3 file and text file full of links, instead. I've searched and searched for a utility and then a script, and I found this script (original URL at the very top of it): ; Th.Aug.14.2025 - https://www.reddit.com/r/autoit/comments/1iz3odb/possible_to_open_multiple_links/ #include <MsgBoxConstants.au3> Example() Func Example() ; Define the path to the text file containing the links Local $sFilePath = @ScriptDir & "\URL_links.txt" ; Read the current script file into an array using the filepath. Local $aArray = FileReadToArray($sFilePath) Local $iLineCount = @extended If @error Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file. Else For $i = 0 To $iLineCount - 1 ; Loop through the array. UBound($aArray) can also be used. ;MsgBox($MB_SYSTEMMODAL, "", $aArray[$i]) ; Display the contents of the array. ShellExecute($aArray[$i]) ;Execute each line from the file Sleep(500) ; Adjust the delay as needed Next EndIf EndFunc ;==>Example And my text file, called "URL_links.txt" I laid out with these example URLs, as per the original message in the URL listed above: https://www.youtube.com/watch?v=GygBY01Qbnk https://www.youtube.com/watch?v=LrAtBtQnvCE&list=RDLrAtBtQnvCE https://www.youtube.com/watch?v=fe5Jk7YT_JE&list=RDfe5Jk7YT_JE https://www.youtube.com/watch?v=44tiZ7IP7zA But nothing happened and no error message appeared. Was wondering if someone know what was wrong. There may be other methods of doing this, but calling on a list within a text file seems the easiest to maintain. Thank you! Edited August 14 by Diana (Cda)
argumentum Posted August 14 Posted August 14 ShellExecute() returns the PID of the running process, if that helps. Did run the code you posted and was all good ( other than a sudden craving for peanut butter due to one of the videos ). Nothing wrong with the code. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted August 14 Posted August 14 All decent web sites have a policy of excessive usage. Maybe you fell under it. You should consider using WebDriver instead, which is lot more permissive. “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
KaFu Posted August 15 Posted August 15 The result of calling ShellExecute() with only the URL as a parameter depends on which default browser you have installed. This works fine for me with FireFox installed on an x64 system. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $sFile = FileRead(@ScriptDir & "\URL_Links.txt") $aLines = StringSplit($sFile, @CRLF, 1) For $i = 1 To $aLines[0] ShellExecute(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe', $aLines[$i], '', 'open') Next OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
ioa747 Posted August 15 Posted August 15 (edited) This works for me too, with Firefox as the default browser and Win10 22H2. Local $sTxt = "" $sTxt &= "https://www.youtube.com/watch?v=GygBY01Qbnk" & @CRLF $sTxt &= "https://www.youtube.com/watch?v=LrAtBtQnvCE&list=RDLrAtBtQnvCE" & @CRLF $sTxt &= "https://www.youtube.com/watch?v=fe5Jk7YT_JE&list=RDfe5Jk7YT_JE" & @CRLF $sTxt &= "https://www.youtube.com/watch?v=44tiZ7IP7zA" $aLines = StringSplit($sTxt, @CRLF, 1) For $i = 1 To $aLines[0] ConsoleWrite("$aLines[$i]=" & $aLines[$i] & @CRLF) ShellExecute($aLines[$i]) Next Edited August 15 by ioa747 remove last @CRLF I know that I know nothing
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