Hi,
Im very confused.
I've read the webbrowser help but haven't got anywhere.
Here is my situaton:
I have 2 WebBrowser objects placed in my Sapien form ($webbrowser1 and $webbrowser 2).
I have a list of links in c:\users\admin\desktop\url.txt (https://google.co.uk and https://bbc.co.uk).
I want each line of the text file to be navigated by each $webbrowser in order.
$url = get-content c:\users\admin\desktop\url.txt
$webbrowser1.navigate($url)
This works if there is only https://google.co.uk in the txt file.
How can I make a kind of foreach loop for both variables, so for each $link in $url navigate to each $webbrowser1, 2, 3, 4 etc?
I need both variables to loop together, i dont know how.
Thanks
Add one variable to another loop
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Add one variable to another loop
Just enumerate the contents of the file in a ForEach-Object.
help foreach -online
Read the examples to learn how to use it.
Or use foreach()
help about_foreach
help foreach -online
Read the examples to learn how to use it.
Or use foreach()
help about_foreach
-
- Posts: 18
- Last visit: Thu Apr 18, 2019 7:07 am
Re: Add one variable to another loop
Im sorry but I still don't understand how to make each line from text file .navigate to each sequential $webbrowserX
-
- Posts: 18
- Last visit: Thu Apr 18, 2019 7:07 am
Re: Add one variable to another loop
Thanks, your replies allowed me to probe further.
I've solved this in a clever way, by creating a new tab for each line in the notepad, adding to the form and adding webbrowser on top. Works very well.
I have another question on the tabcontrol but will post new topic as not very related to this one. thanks
I've solved this in a clever way, by creating a new tab for each line in the notepad, adding to the form and adding webbrowser on top. Works very well.
I have another question on the tabcontrol but will post new topic as not very related to this one. thanks