Solved

VBScript problem in Finalbuilder action builder

Posted on 2011-03-01
4
679 Views
Last Modified: 2012-06-22
I am trying to create a form in finalbuilder that uses VBscript, something I never used.

I need to parse the items in a listbox so am using a for loop.

How do I read the items in the listbox and assign to a string?

I know it seems simple but I still need it.

Thanks

David
0
Comment
Question by:dbdp
  • 2
4 Comments
 

Author Comment

by:dbdp
ID: 35008452
The code below gives me an error "Expected end of statement"
Function isUniquePath(Argument1)

isUniquePath = true

dim iCount
dim sSelected 
dim i

iCount = Page.lbPaths.items.count

if(iCount > 0) then
for i = 1 to (iCount)

sSelected = Page.lbPaths.options[i].value
next

end if

end function

Open in new window

0
 
LVL 6

Expert Comment

by:Alan Gunn
ID: 35008733
At first glance I think it's the square brackets in line 14.
More soon... :-)
0
 
LVL 6

Accepted Solution

by:
Alan Gunn earned 500 total points
ID: 35009065
Hi!

The attached code is for an HTA which contains html and vbscript.

As you can see, the line 21 code is very similar to the select in your code but with normal brackets.

Give that a try. :-)

Cheers!

TRM

<html>
<head>
<title>My HTML application</title>
<HTA:APPLICATION
  APPLICATIONNAME="My HTML application"
  ID="MyHTMLapplication"
  VERSION="1.0"/>
</head>

<script language="VBScript">

Sub Window_OnLoad
  'This method will be called when the application loads
  'Add your code here
End Sub
'Displays all the items selected in a multi-select listbox

Sub RunScript
    For i = 0 to (Dropdown1.Options.Length - 1)
        If (Dropdown1.Options(i).Selected) Then
            strComputer = strComputer & Dropdown1.Options(i).Value & vbcrlf
        End If
    Next
    Msgbox strComputer
End Sub  
Sub OnClickButtonShowSelected()
RunScript
  'This method will be called when button "ShowSelected" is clicked
  'Add your code here
End Sub
</script>

<body bgcolor="white">

<!--Add your controls here-->
<select size="3" name="DropDown1" multiple>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</select>

<input type="button" name="ShowSelected" id="ShowSelected" value="Show Selected" onclick="OnClickButtonShowSelected">
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>

Open in new window

0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35012525
The first suggestion might be correct, try changing
sSelected = Page.lbPaths.options[i].value

Open in new window

to
sSelected = Page.lbPaths.options(i).value

Open in new window


Rob.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now