Jump to content
lordsocke

Link opener

Recommended Posts

lordsocke

Hi guys im new here and im not sure if it is the right section so please move me if im wrong :D

So I want to create a programm where you are able to open links from a .txt flie one by one automaticly can anybody tell me how to do this best? 

Share this post


Link to post
Share on other sites
Chimp

@Celtic88 your way will run only the first link

try this variant:

#include <File.au3>
Local $aRecords
If Not _FileReadToArray("Links.txt", $aRecords) Then
    MsgBox(4096, "Error", " Error reading file to Array     error:" & @error)
    Exit
EndIf
For $x = 1 To $aRecords[0]
    ShellExecute("iexplore.exe", $aRecords[$x])
Next

 

Edited by Chimp
  • Like 1

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
lordsocke

@Chimp yours worked very fine but how can I open them one by one until they are loaded?

Share this post


Link to post
Share on other sites
TheDcoder

@lordsocke You need:

For
Next
FileReadToArray
ShellExecute

That's all you need, TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
ViciousXUSMC

This is my crack at it.  Assuming I get what you want to be opening a list of sites from a txt file but not opening them all at once instead opening the next after the first is closed.

To make this browser independent I did not use any of the IE functions and use a hotkey + variable combo to trigger the "open next" 

Everything will open with your default browser.

;Set Alt+n to open next site and close current
HotKeySet("!n", "WaitNext")

;Read files from SiteList.txt to an array
$aFileList = FileReadToArray("SiteList.txt")

#cs
sitelist.txt example
Https://Google.com
Http://Cisco.com
https://www.autoitscript.com/forum
#CE

For $i = 0 to UBound($aFileList) -1
    $vNext = 1
    ShellExecuteWait($aFileList[$i], "", "", "", @SW_MAXIMIZE)
    While $vNext = 1
        Sleep(10)
    WEnd
Next

Func WaitNext()
    $vNext = 2
    WinClose("")
EndFunc

 

Share this post


Link to post
Share on other sites

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

×