SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Schedule job cannot end

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Schedule job cannot end
Author Message
jwww001



Joined: 13 Feb 2012
Posts: 8
Country: Hong Kong

Post Schedule job cannot end Reply with quote
I created a job to run the following vbscript. I can see the message "Exit1" and the script completed. However, I still can see the job is running in the job monitoring screen. This cause the subsequent jobs can not be started. Do you have any ideas why?


Option Explicit
Dim app

Call dowork

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

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

prjName = "C:\project.egp" 'Project Name

Set app = CreateObject("SASEGObjectModel.Application.4.2")
app.SetActiveProfile("CCR")
MsgBox "1"
If Checkerror("CreateObject") = True Then
Exit Sub
End If

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


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


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

'-----
' Close the project
'-----
MsgBox "7"
prjObject.Close
MsgBox "8"
If Checkerror("Project.Close") = True Then
Exit Sub
End If
Set prjObject = Nothing
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
Mon Feb 13, 2012 6:05 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6485

Post Reply with quote
It looks like one of the objects you created is not getting destroyed, locking resources and holding the entire job in the running state

For example

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


the code above checks for an error Checkerror("Project.Save") = True and exits leaving prjObject running. Please try adding Set prjObject = Nothing to the Checkerror function.
Tue Feb 21, 2012 9:28 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.