Solved

VBScript problem in Finalbuilder action builder

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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