Hello all,
I have recently been testing Business Objects 5.1.8 for my work and trying to see if we can still use our old method of Automation that we used with 4.1.5. In the past we scheduled jobs through Windows Task Scheduler that kicked off business objects with a line similar to this:
The scripts were located in the Scripts directory, along with matching .sbx files (I’m not sure what these are, but they aren’t text that’s for sure). I wanted to give one of these scripts a try with 5.1.8. The script in particular that I tried was an e-mail script. I ensured that the script worked with Broadcast Agent (we are having reliability issues with BCA so we would like to get the Windows Task Scheduler working with 5.1.8 instead). The script doesn’t appear to do anything when I schedule it through task scheduler, it just sits there the entire time until its window is gone, and it shouldn’t take more than 10-15 seconds to run. The line that I have in the new scheduler looks like this:
But I have tried without the -nologo, without the -blind, I’ve tried having the .spt included at the end of the script name. I have tried opening the report (which works from command line, but the script doesn’t run so there isn’t much point in that). I have made sure that no prompts for passwords or wizards or macros are coming up when I start busobj.exe from command line with these options as well.
Here is the script that I am trying to run (some things have been removed for privacy :P, and this isn’t my script, I am pretty new to VBScript so there could be some pretty obvious errors in it and me not know it.
Dim appint
Dim vars
Dim objDoc
Dim objRpt
Dim i As Integer
Dim strFile As String
Dim objMail As Object
Sub main()
Set appint = CreateObject("BusinessObjects.Application")
appint.Interactive = False
Set vars = appint.Variables
strReportName = "DatabaseCodeChangeAuto"
Set objDoc = appint.Documents.Open(strReportName)
objDoc.Refresh
Set objMail = CreateObject("Persits.MailSender")
objMail.ResetAll
'Build the email
objMail.Host = "smtpserveraddress.somewhere.com"
objMail.From = "person1@somewhere.com"
objMail.Subject = "Business Objects: " & strReportName
objMail.Body = "Database Code Changes Report is attached"
objMail.IsHTML = True
objMail.AddAddress ("person1@somewhere.com")
objMail.AddAddress ("person2@somewhere.com")
For i = 1 To objDoc.Reports.Count
strFile = "c:\temp\" & strReportName & "_" & i & ".rtf"
Set objRpt = objDoc.Reports.Item(i)
objRpt.ExportAsRtf (strFile)
'Add Attachments
objMail.AddAttachment strFile
Next i
objDoc.Close
'Send Email
objMail.Send
objMail.ResetAll
Set objMail = Nothing
Application.Exit
End Sub
The Persits mail sender is installed and functioning, I have verified that it worked with BCA.
So, does anyone have any ideas as to what I am doing wrong, or if what I am trying to do is even possible with this version of Business Objects?
Thanks for your help!
Toby
Tobyus (BOB member since 2005-09-22)