## Recommended Posts

I have a webpage that has a collection of hyperlinks. I need to get the list of links. To do that, I started with this, and it will display them in the console: (code found doing a search in the forum) (thanks Dale!)

Next

The report to the console is this, which is what I want to put into the array:

```0
Help
00630383
00630442
00631654
00632038
00627526
00632520
00630998
00630363
00618712
00631318
http://xxxxxx/xxxxxxx
00599640
00621858
00630371
00618672
00627293 - 0002
00627308 - 0009
00629003 - 0001
00618672 - 0003
00621184 - 0002
00621184 - 0003
00621184 - 0004
00621184 - 0001
00627308-0005 - sub1```

My question is, how do I get this list in a array? I tried this:

\$arr = StringSplit(\$d & @CR, @CR)

It reports 3 items, and the only one in the array that has what I want is the last one. Currently the webpage has over 20 links in it, and I need to get the ones that meet a certain criteria (Text name only has numbers in it, no letters) The amount of links is NOT a constant (changes at the drop of a hat), so I was trying to first get the collection, then put that list into a array. How do I get what is being put to the console into a array?

##### Share on other sites

I suppose you could declare an array at the top of the script and then just do this:

```For \$oLink in \$oLinks
Next```

Perfect! thanks!

##### Share on other sites

Second question along the same lines - I'm making a webpage using autoit that will make a series of frames, and open the list I got. Can I get a example of getting a link collection from one page (3 links), then having each link be opened in a frame in a new page?

I have this, but it doesn't work:

```dim \$s_html
\$s_html &= "<HTML>" & @CR
\$s_html &= "<TITLE>Service Request My Documents Expanded Report</TITLE>" & @CR
\$s_html &= "<STYLE>body {font-family: Arial}</STYLE>" & @CR
\$s_html &= "<frameset rows='100%,100,100%'>"& @CR
\$s_html &= "<frame name='1' src='about:blank' scrolling='yes'>"& @CR
\$s_html &= "<frame name='2' src='about:blank' scrolling='yes'>"& @CR
\$s_html &= "<frame name='3' src='about:blank' scrolling='yes'>"& @CR
\$s_html &= "<noframes>" & @CR
\$s_html &= "<BODY>"  & @CR
\$s_html &= "</HTML>" & @CR
\$s_html &="</noframes>" & @CR
\$s_html &="</frameset>" & @CR
\$s_html &= "</BODY>"
_IEDocWriteHTML(\$ff, \$s_html)

\$p = 0
do
\$sMyString = \$Array[\$p]
\$oFrame = _IEFrameGetObjByName (\$ff, "1")
ExitLoop
EndIf
\$l = \$l +1
next
until \$l = 1```

##### Share on other sites

And "doesn't work" means what exactly? (see my sig)

Also, I can't run your code due to missing variables.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

Automate input type=file (Related)

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

##### Share on other sites

I'm closer to getting what I want. The only trouble I'm having now is 2 things:

1. I need to navigate the first frame I have made to the first item in my \$links array

2. I need to come up with a method to make a number of frames depended on the number of links. If there are 4 links for example, then I will have 4 frames. Currently, I have 3 frames being made for testing.

```#include <IE.au3>
#include <Array.au3>
;opens the page
\$oIE = _IECreate("http://xxxxxxxxxxxxxxxxxxxxxxxxxx", 0, 1)
ExitLoop
EndIf
Next

Next
_ArrayDelete(\$Array,0)
_ArrayDelete(\$Array,0)
_ArrayDelete(\$Array,0)
_ArrayDelete(\$Array,0)
;got list of links from page with names to edit with. No need to change code from this point up.
\$iMax = UBound(\$array)
\$p = 0
Do
\$str = StringIsDigit(\$Array[\$p])
\$siS = StringInStr(\$Array[\$p], "http:")
\$siS1 = StringInStr(\$Array[\$p], " - ")
if \$str = 1 then
\$p = \$p +1
Elseif \$siS = 1 then
_ArrayDelete(\$Array,\$p)
\$iMax = UBound(\$array)
Else
if \$siS1 > 1 then
\$p = \$p +1
Endif
endif
\$iMax = UBound(\$array)
until \$p = \$iMax

dim \$s_html
\$s_html &= '<HTML>' & @CR
\$s_html &= '<TITLE>Service Request My Documents Expanded Report</TITLE>' & @CR
\$s_html &= '<STYLE>body {font-family: Arial}</STYLE>' & @CR
\$s_html &= '<frameset rows="100%,100,100%">'& @CR
\$s_html &= '<frame name="1" src="about:blank" scrolling="yes">'& @CR
\$s_html &= '<frame name="2" src="about:blank" scrolling="yes">'& @CR
\$s_html &= '<frame name="3" src="about:blank" scrolling="yes">'& @CR
\$s_html &= '<noframes>' & @CR
\$s_html &= '<BODY>'  & @CR
\$s_html &= '</HTML>' & @CR
\$s_html &= '</noframes>' & @CR
\$s_html &= '</frameset>' & @CR
\$s_html &= '</BODY>'
_IEDocWriteHTML(\$ff, \$s_html)
\$nnn = _IEGetObjByName (\$oIE, \$Array[1])
\$oFrame = _IEFrameGetObjByName (\$ff, "1")

##### Share on other sites

I figured out I needed to do a refresh to \$ff after I write the html to get it to work. I'm still having trouble getting the frames to be the correct size. They keep sizing themselfs to the size of the screen in that I want to have the webpage be split so that I have a fill page per frame. If I try for 3 frames for example, it splits the viewing area into 3 secions, but does not resize the page to make it 3 times as big.

I hope I'm explaining this right

##### Share on other sites

switched to tables with a array design. Seems to do what I want.

## Create an account

Register a new account