Paul Randall a exprimé avec précision :
> "at" <at@newsgroup> wrote in message
> news:4bce14a2$0$2946$ba4acef3@newsgroup
>> Paul Randall a exposé le 20/04/2010 :
>>
>>> 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/d...3-ae7b9152e6d9
>>>
>>> The URL is long, so you may have to unwrap it.
>>> -Paul Randall >>
>> In the web page, i found this:
>>
>> ...
>> var dhcp_data = new Array();
>> dhcp_data[0] = new Array(find_userfriendlyname(js_host_list,
>> '00:a0:aa:aa:1a:a0'), '192.168.1.18', '00:9a:da:aa:18:a0', null, null);
>> dhcp_data[1] = new Array(find_userfriendlyname(js_host_list,
>> '00:0e:ee:de:eb:e9'), '192.168.1.19', '00:aa:e4:d7:3b:a9', null, null);
>> ...
>>
>>
>> I try to read value in dhcp_data[1] with vbscript after load document with
>>
>> Set ie = CreateObject("InternetExplorer.Application")
>> ie.navigate "http://www.example_page.com"
>> ...
>>
>>
>> it's possible ? >
> Here is an HTA example using Evertjan's method:
>
> <html>
> <head>
> <title>JS Array to VBS array</title>
> <script language="vbscript">
> 'Putting this script here prepositions the window.
> 'Windowstate=Maximize would override this.
> Const wdDlg = 600, htDlg = 380 ' dialog size
> Const pxLeft = 100, pxTop = 100 ' positioning
> window.ResizeTo wdDlg,htDlg
> window.MoveTo pxLeft,pxTop
> </SCRIPT>
> <HTA:APPLICATION
> ID="Put your ID here"
> APPLICATIONNAME="Put your application name here"
> SCROLL="yes"
> SINGLEINSTANCE="no"
> WINDOWSTATE=""> </head>
>
> <SCRIPT Language="JScript">
> var a, b;
> a = new Array(0,1,2,3,4);
> b = a.join("-");
>
> </SCRIPT>
>
> <SCRIPT Language="VBScript">
> msgbox b
> myArray = split(b,"-")
> msgbox join(myarray, vbcrlf)
> </SCRIPT>
> <body>
> </body>
> </html> But you place the VBscript in web page! I want found the array value
with an external script.
And the web page contain:
var dhcp_data = new Array();
dhcp_data[0] = new Array(find_userfriendlyname(js_host_list,
'00:a0:aa:aa:1a:a0'), '192.168.1.18', '00:9a:da:aa:18:a0', null, null);
dhcp_data[1] = new Array(find_userfriendlyname(js_host_list,
'00:0e:ee:de:eb:e9'), '192.168.1.19', '00:aa:e4:d7:3b:a9', null, null);
and i try to view value in dhcp_data[1] with the Vbscript launch from
windows, not in the web page.
With another example with a internet web page:
<html>
<script type='text/javascript'>var js_mbv_dhcpserverenabled = '1';var
js_mbv_ipinterfaceipaddress = '192.168.1.1';
</script>
<body>
<form method="POST" action="bot">
<p><input type="text" name="lacase" size="20" value="hello"><input
type="submit" value="Send" name="B1"><input type="reset" value="Cancel"
name="B2"></p>
</form>
</body>
</html>
Now,i can view value "lacase" with a Windows VBScript
' VBSCRIPT ------------------
Set objShell = WScript.CreateObject("WScript.Shell" )
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "d:\example.htm"
msgbox ie.document.All.tags("input").Item("lacase").Value
' --------------------------------
Now, how to retrieve value in "js_mbv_ipinterfaceipaddress" ?
Regard.