BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello, everybody. Sorry for my terrible english in advance. I hope, you'll help find me find out, what am i doing wrong)

I have a project, which i want to run by schedule. EG created default VBscript (Tools->Schedule Project how it was written in manual).

Option Explicit
Dim app

Call dowork

'shut down the app
If not (app Is Nothing) Then
app.Quit
Set app = Nothing
End If


Sub dowork()
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----
Dim prjName
Dim prjObject

prjName = "C:\SAS\sending_test.egp" 'Project Name

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

'-----
' open the project
'-----
Set prjObject = app.Open(prjName,"")
If Checkerror("app.Open") = True Then
Exit Sub
End If


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


'-----
' 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
Dim errNum

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


When i' m trying to run this script, nothing happens!

I tried to delete error check from my script, ones again run it and recieved th message from Windows Script Host: Unable to connect to server: SASMain.
So to run project i'm forced to push the button "run branch from .... task", then enter login and password to connect to server! Is it possible to correct my script so, that connection to server and running of my tasks occurs automatic?

Thank you!
2 REPLIES 2
deleted_user
Not applicable
Hi Tano,

Have you seen this SAS-Note?: http://support.sas.com/techsup/unotes/SN/014/014700.html
In the bottom you'll find a link to the OLE Automation Guide, which is the engine for EG Scheduling.

Anyhow, I do not know anything about Visual Basic programming, so I'll just assume that you wrote everything right; what I do know is that to schedule an EG project you should create (if EG doesn't do it for you), an Scheduled Task in Windows Control Panel.

Identify the task that corresponds to your Project and set the USERID & PASSWORD you'll use in there. If you're working on a remote SAS server, make sure that your UserId starts with the Windows Domain. i.e. domain\userid.

PS: If you double-click on the task and it doesn't run immediatly, it means that there's something wrong with the code.

Cheers
SteUpenn
Calcite | Level 5

Hi,

I am having the same issue where you able to resolve it?

Thanks,

Stephanie

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2151 views
  • 0 likes
  • 2 in conversation