From: at on
Hi,

With this source code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript">

var f = document.forms['test'];

var l = f.land.options.length;
var provincie = new Array(l);

for(i = 0; i < l.length; i++){
provincie[i] = new Array();
}

provincie[0][0] = "Kies eerst een land";

provincie[1][0] = "Kies een";
provincie[1][1] = "Groningen";
provincie[1][2] = "Friesland";
provincie[1][3] = "Drenthe";
provincie[1][4] = "Gelderland";

var t = f.provincie;

function zetProvincies(x){
for(i = 0; i < provincie[x].length; i++){
t.options[i] = new Option(provincie[x][i], provincie[x][i]);
}
}

</script>
</head>
<body>
<form id="test" name="test" method="post" action="" >
<table>
<tr>
<td ><font class="content">Land </font></td>
<td>
<select name="land" size="1"
onChange="zetProvincies(this.options.selectedIndex)">
<option value="0" selected>Geen Selectie</option>
<option value="1">Nederland</option>
</select>
</td>
</tr>
<tr>
<td><font class="content">Provincie </font></td>
<td>
<select name="provincie">

</select>
</td>
</tr>
</table>
</form>
</body>
</html>


How to retrieve or read all arrays "provincie" in vbs ?

Thx


From: paulwillekens on
Hi At,

Though your problem is not stated very clearly, I assume you want to
retrieve the few dutch provinces as used in the .html ? "all arrays"
you say, but I see only one...

If you want a .vbs to extract those 4 provinces, it seems a clear case
of overkill: just grab them in a text editor...

If your problem is different, then please state it clearly.

Kind regards

Paul Willekens
From: at on
paulwillekens a formul� ce mardi :
> Hi At,
>
> Though your problem is not stated very clearly, I assume you want to
> retrieve the few dutch provinces as used in the .html ? "all arrays"
> you say, but I see only one...
>
> If you want a .vbs to extract those 4 provinces, it seems a clear case
> of overkill: just grab them in a text editor...
>
> If your problem is different, then please state it clearly.
>
> Kind regards
>
> Paul Willekens

But, with

Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "http://www.thepagewithprovinces.com"
....


It's possible to assign directly the Array from javascript into a
variable in VBS ?

Or use RegExp ?

Regard


From: Paul Randall on

"at" <at(a)noemail.fr> wrote in message
news:4bcd82cb$0$2962$ba4acef3(a)reader.news.orange.fr...
> paulwillekens a formul� ce mardi :
>> Hi At,
>>
>> Though your problem is not stated very clearly, I assume you want to
>> retrieve the few dutch provinces as used in the .html ? "all arrays"
>> you say, but I see only one...
>>
>> If you want a .vbs to extract those 4 provinces, it seems a clear case
>> of overkill: just grab them in a text editor...
>>
>> If your problem is different, then please state it clearly.
>>
>> Kind regards
>>
>> Paul Willekens
>
> But, with
>
> Set ie = CreateObject("InternetExplorer.Application")
> ie.navigate "http://www.thepagewithprovinces.com"
> ...
>
>
> It's possible to assign directly the Array from javascript into a
> variable in VBS ?
>
> Or use RegExp ?
>
> Regard

I don't know how to get the JScript array directly transferred to a VBScript
array. I would have my standalone VBScript load the HTML file in an IE
object and use the DOM to get at what I want. Of course, sometimes you
can't get directly to the web page that you are interested in, so you may
have to set up a way to pause your script while you manually navigate, in
the script's IE window, to the page of interest, and then have the script do
its thing of getting the info of interest. A message box works fine for
pausing the script, and when you continue the script by clicking OK on the
message box, you will want to get the current IE document with something
like Set oIEDoc = oIE.Document.

One fairly quick way to learn about how to manipulate many of the features
of the HTML DOM is to study a Microsoft HTA that can be used to build other
HTAs, called HTA Helpomatic. All of its scripting is VBScript. HTAs use
objects identical to those in HTML. Download it here:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=231d8143-f21b-4707-b583-ae7b9152e6d9

The URL is long, so you may have to unwrap it.
-Paul Randall


From: Evertjan. on
Paul Randall wrote on 20 apr 2010 in
microsoft.public.scripting.vbscript:

> I don't know how to get the JScript array directly transferred to a
> VBScript array.

Try:

var temp = join(jsArray,'|');


vbArray = split(temp,"|")


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)