Solved

VBScript problem in Finalbuilder action builder

Posted on 2011-03-01
4
686 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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ā€¦
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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