Solved

VBScript problem in Finalbuilder action builder

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

12 Experts available now in Live!

Get 1:1 Help Now