Jump to content

Recommended Posts

Posted (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 by Diana (Cda)
  • Diana (Cda) changed the title to Open multiple URLs at once (replacing browser function on startup which is horrible)?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...