Desktop productivity for business analysts and programmers

Launch SAS project (EGP) and RUN specific ProcessFlow with VBS

Reply
N/A
Posts: 0

Launch SAS project (EGP) and RUN specific ProcessFlow with VBS

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "SEGuide.exe K:\RUN\Process\TRY.egp"""


Hello world ;-)

I create a macro to launch a specfic project with SE Guide.

But ...

I would like to RUN a specific process flow (name = DATA) of the project (TRY.egp).

Is it possible to specify in the script vbs that the process flow named "DATA" has to be opened and RUN (F3) ?

If not, is there any way to do it otherwise ?

Thanks in advance.

Best regards Message was edited by: Fab.from.be
Super Contributor
Super Contributor
Posts: 3,174

Re: Launch SAS project (EGP) with VBS

Check the SAS support http://support.sas.com/ website - much info and reference resources to be found there. Also, check the SAS forums archive as well.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic/post:
enterprise guide launch project site:sas.com
N/A
Posts: 0

Re: Launch SAS project (EGP) with VBS

> Check the SAS support http://support.sas.com/
> website - much info and reference resources to be
> found there. Also, check the SAS forums archive as
> well.
>
> Scott Barry
> SBBWorks, Inc.
>
> Suggested Google advanced search argument, this
> topic/post:
> enterprise guide launch project site:sas.com


Thanks !

I found something which could be interesting but ... I 'm quite noob in VBS.

The original code I found in the support.sas in the following (see here attached under).

I just need a "quite simpler script" which will launch SE Guide and run the processflow.

Is somebody able to help me with this ? :s

Thanks

- - - - - -

Option Explicit
Dim app ' As SASEGuide.Application

Dim prjName ' As String
Dim prjObject ' As SASEGuide.Project

Dim PFDName ' As String
Dim PFDObject ' As SASEGuide.ProcessFlow
Dim pfdColl ' As SASEGuide.ProcessFlowCollection

prjName = "C:\Documents and Settings\PFD_Order.egp" ' Project Name

Call dowork2
Call dowork1
Call dowork3
Call CloseAndQuit


Sub dowork2()
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----


PFDName = "PFD2" ' PFD Name

Set app = CreateObject("SASEGObjectModel.Application")
If Checkerror("CreateObject") = True Then
Exit Sub
End If

Set prjObject = app.Open(prjName,"")
If Checkerror("App.Open") = True Then
Exit Sub
End If


'-----
'Get The PFD Collection and Object
'-----
Set pfdColl = prjObject.ProcessFlowCollection
If Checkerror("Project.ProcessFlowCollection") = True Then
Exit Sub
End If

Dim i ' As Long
Dim count ' As Long
count = pfdColl.count
For i = 0 To count
Set PFDObject = pfdColl.Item(i)
If Checkerror("ProcessFlowCollection.Item") = True Then
Exit Sub
End If

If (PFDObject.Name = pfdName) Then
Exit For
Else
Set PFDObject = Nothing
End If
Next

If not (PFDObject Is Nothing) Then
'----
' Run the PFD
'----
PFDObject.Run
If Checkerror("ProcessFlow.Run") = True Then
Exit Sub
End If
End If


End Sub


Sub dowork1()
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----

PFDName = "PFD1" ' PFD Name


'-----
'Get The PFD Collection and Object
'-----
Set pfdColl = prjObject.ProcessFlowCollection
If Checkerror("Project.ProcessFlowCollection") = True Then
Exit Sub
End If

Dim i ' As Long
Dim count ' As Long
count = pfdColl.count
For i = 0 To count
Set PFDObject = pfdColl.Item(i)
If Checkerror("ProcessFlowCollection.Item") = True Then
Exit Sub
End If

If (PFDObject.Name = pfdName) Then
Exit For
Else
Set PFDObject = Nothing
End If
Next

If not (PFDObject Is Nothing) Then
'----
' Run the PFD
'----
PFDObject.Run
If Checkerror("ProcessFlow.Run") = True Then
Exit Sub
End If
End If


End Sub


Sub dowork3()
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----

PFDName = "PFD3" ' PFD Name


'-----
'Get The PFD Collection and Object
'-----
Set pfdColl = prjObject.ProcessFlowCollection
If Checkerror("Project.ProcessFlowCollection") = True Then
Exit Sub
End If

Dim i ' As Long
Dim count ' As Long
count = pfdColl.count
For i = 0 To count
Set PFDObject = pfdColl.Item(i)
If Checkerror("ProcessFlowCollection.Item") = True Then
Exit Sub
End If

If (PFDObject.Name = pfdName) Then
Exit For
Else
Set PFDObject = Nothing
End If
Next

If not (PFDObject Is Nothing) Then
'----
' Run the PFD
'----
PFDObject.Run
If Checkerror("ProcessFlow.Run") = True Then
Exit Sub
End If
End If


End Sub



Sub CloseAndQuit()

' Save the new project
'-----
prjObject.Save
If Checkerror("Project.Save") = True Then
Exit Sub
End If

'-----
' Close the project
'-----
prjObject.Close
If Checkerror("Project.Close") = True Then
Exit Sub
End If

End Sub



Function Checkerror(fnName)
Checkerror = False

Dim strmsg ' As String
Dim errNum ' As Long

If Err.Number <> 0 Then
strmsg = "Error #" & Hex(Err.Number) & vbCrLf & "In Function " & fnName & vbCrLf & Err.Description
'MsgBox strmsg 'Uncomment this line if you want to be notified via MessageBox of Errors in the script.
Checkerror = True
End If

End Function

- - - - - - Message was edited by: Fab.from.be
Ask a Question
Discussion stats
  • 2 replies
  • 229 views
  • 0 likes
  • 2 in conversation