Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Javascript array to VBS?

Status
Not open for further replies.

theniteowl

Programmer
May 24, 2005
1,975
US
I am working on an HTA script that uses a bit of Javascript for the on-page data input and validation.
I need to determine how to pass the contents of a javascript array over to VBScript.

My VBS code parses through a log file looking for matching strings of text in a VBS array. I just have to determine how to send the contents of the Javascript array to the VBScript array.

Thoughts?

At my age I still learn something new every day, but I forget two others.
 
You could write the contents of the array to a file from the javascript and then read it back into the VBS?

 
You could write the contents of the array to a file from the javascript and then read it back into the VBS?

Yes that would work, it would just be a bit inelegant when it should be possible directly in the code.


At my age I still learn something new every day, but I forget two others.
 
Unfortunately PHV, this is an HTA app that is not running on an IIS server. I had seen that site in my searching but could not see how it could be readily applied to my situation.

As a workaround I setup a javascript function that calls a VBScript function in a loop passing the array elements one at a time. The VBScript function ReDims the VB array and adds the new element.

This would not be a good solution if I were passing a LOT of data but I will probably be passing only 4-5 elements. Each element can contain a short or fairly long text string though so I did not want to pass it all as one big delimited string.

This seems to be working. My next alternative would have been to write it all out to a hidden form field and read it back in from the VBScript side and parse it out into an array.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top