ExecuteScript Method (Application)
Instance of the Rational Rose application in which the script is being executed
Name of the file that contains the script to execute
- - - - - - - - - - - - - - - - - - -
see if I could somehow get the arguments, but no go.
here. The only Kludge that comes to mind, is to create
a text file with value in vb, read in rosescript.
- VB test program ---------------------
Dim aClass As Object
Dim allClasses As Object
Dim roseApp As Object
On Error Resume Next
Set roseApp = GetObject(, "Rose.Application")
If roseApp Is Nothing Then
Set roseApp = CreateObject("Rose.Application")
End If
'When you call GetRoseApplication the first time, the value
'of roseApp will be Nothing and GetObject will be
'attempted. If GetObject fails, then a new instance is
'created using CreateObject. From that point on you will be
'using the same instance of Rose's automation server.
'If you relied on GetObject, your program would break if the
'user opened another instance of Rose.
roseApp.Visible = True
'theApplication.ExecuteScript theFileName
scriptname = "e:\t4\test.ebx"
roseApp.ExecuteScript scriptname
MsgBox ("DONE")
End Sub
Sub Main
' rose "arg1 arg2 arg3" myscript.ebx
' then Rose will be called with the execution of the ebx
' file and the string of args will be accessible from
' roseapp.commandline
' Command line string: arg1 arg2 arg3
' Argument 1: arg1
' Argument 2: arg2
' Argument 3: arg3
' DOCUMENT:Q126939
' TITLE :How To Parse a Delimited String Using InStr And Mid
viewport.clear
Redim SubStr(0) As String
Dim SubStrCount As Integer
Dim i As Integer
DataString = roseapp.commandline
' workaround for defect in rose
' "arg1 arg2 arg3" returns
' "arg1 arg2 arg3
' i.e. leading " retained
x = Len(DataString)-1
DataString = Right$(DataString,x)
SubStrCount = ParseString(SubStr(), DataString, " ")
For i = 1 to SubStrCount
Print "Argument " & i & ": " & SubStr(i)
Next
String) As Integer
ReDim SubStrs(0) As String
Dim CurPos As Long
Dim NextPos As Long
Dim DelLen As Integer
Dim nCount As Integer
Dim TStr As String
SrcStr = Delimiter & SrcStr & Delimiter
' Calculate the delimiter length only once:
DelLen = Len(Delimiter)
' Initialize the count and position:
nCount = 0
CurPos = 1
NextPos = InStr(CurPos + DelLen, SrcStr, Delimiter)
Do Until NextPos = 0
' Extract a sub-string:
TStr = Mid$(SrcStr, CurPos + DelLen, NextPos - CurPos - DelLen)
' Increment the sub string counter:
nCount = nCount + 1
' Add room for the new sub-string in the array:
ReDim Preserve SubStrs(nCount) As String
' Put the sub-string in the array:
SubStrs(nCount) = TStr
' Position to the last found delimiter:
CurPos = NextPos
' Find the next delimiter:
NextPos = InStr(CurPos + DelLen, SrcStr, Delimiter)
Loop
ParseString = nCount
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 10:29 AM
To: 'Kennedy, Patrick'; [EMAIL PROTECTED]
Subject: RE: (ROSE) RoseScript and VB
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Kennedy, Patrick
Sent: Thursday, November 21, 2002 8:17 PM
To: 'Dan Liu'; [EMAIL PROTECTED]
Subject: RE: (ROSE) RoseScript and VBCheck out the following, might help,
http://solutions.rational.com/solutions/
Solution Id: 9832
WINDOWS: How to pass parameters to Rational Rose scripts?Patrick Kennedy
Rational Support-----Original Message-----
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 4:33 PM
To: [EMAIL PROTECTED]
Subject: (ROSE) RoseScript and VB
Hi, all
I am execute a RoseScript file from a VB program, using method call
RoseApp.ExecuteScript .
Is there any way to pass a parameter from the VB program to the RoseScript,
so the RoseScript can use the parameter while runing.Appreciate your helps. /dan
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
* http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
* To: [EMAIL PROTECTED]
* Subject: <BLANK>
* Body: unsubscribe rose_forum
*************************************************************************
