Solved

VBScript problem in Finalbuilder action builder

Posted on 2011-03-01
4
691 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

729 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