Load URL from List?

Hey folks,

There is probably a simple way to do this but its escaping me!

Im trying to load URL’s from a button press to load in a DesktopHTMLViewer. But each time the button is pressed it I need it to load the next URL in a list.

I have a list of urls in a text file but it doesnt nessessarly need to get its information from the .txt file. I have around 40 URLS i need it to cycle through.

Could anyone point me in the right direction to get started?

Many many thanks in advanced!!


have an array of strings as a property of the window.
Fill the array with your URLs.

In the button pressed/action event,

if there are any values in the array,
showURL thearray(0)
thearray.remove(0) // RemoveAt(0) in API2


Thank you Jeff!

I had a bit of brain fart and found another way.

I used a property in the window called “URLS1 as integer and default set at 0”

and in the button i used select case as below.

Select Case Self.URLS1 
Case 0
Case 1
Case 2
Case 3
Case 4
End Select

URLS1 = URLS1 + 1

if URLS1 > 4 then
  URLS1 = 0
end if

Fair enough.
You didn’t say you wanted to rotate the list.

I’ll offer you this mod:

Window property
URLS() as string

In window open event:

URLS.append "https://www.example1.com"
URLS.append "https://www.example3.com"
URLS.append "https://www.example2.com"
URLS.append "https://www.example7.com"
URLS.append "https://www.example9.com"
URLS.append "https://www.example17.com"

In the button action event:

static nextURL as integer
nextURL = (nextURL +1) mod 6    // 6 or however many URLs you have
//adds 1 until you reach 6, when it becomes 0 again

What’s wrong with:

urlstr = thearray(0)
showURL (urlstr)  // or whatever the syntax is

ad infinitum.

1 Like

Also valid. I like it.