If you are unable to create a new account, please email support@bspsoftware.com

 

how to close the impromptu browser automatically while using Scheduler.

Started by prashanth, 13 Sep 2005 02:20:05 AM

Previous topic - Next topic

prashanth

I really appretiate your solution, but the problem is that i'am bit week in writing Macros & scripts. Iwul be very greatfull to you if you provide me with the buggless code so that I can implement over here.
Let me tell you my problem once again, I'am using Cognos ER Series 7. There is a schedular which runs 100s of tasks a day. Everytime schedular runs the task it opens a new Impromptu Browser which inturn leads to 100s of windows on my Desktop.  I came across 2 solutions & that is
1> To run "c:\Cognos\cer2\bin\ImpAdmin.exe/si" To run in a single instance in command prompt.
2> To write a macro.

As I told you that i'am pretty weak in writing Macro so i'am finding bit difficult to code.
And as far as First Solution that is :\Cognos\cer2\bin\ImpAdmin.exe/si" , to run in command prompt, Its not working, Again its leads to same old problem.

I would be very great ful to you if you provide me the exact solution this problem if possible with the code.

cognosfreelancer

Assuming that you have ImpRep as the object representing an Impromptu report you need to call on the closereport method on it.

Next, assuming that you have ImpApp as the object representing the Impromptu application itself, you need to call on the quit method on it. Then to be safer you set ImpApp= nothing.

The positioning of these is important, they need to be at the end as well as in the error handler code

NKT

prashanth

Hi,   
   I really appretiate your solution, but the problem is that i'am bit week in writing Macros & scripts. Iwul be very greatfull to you if you provide me with the buggless code so that I can implement over here.
Let me tell you my problem once again, I'am using Cognos ER Series 7. There is a schedular which runs 100s of tasks a day. Everytime schedular runs the task it opens a new Impromptu Browser which inturn leads to 100s of windows on my Desktop.  I came across 2 solutions & that is
1> To run "c:\Cognos\cer2\bin\ImpAdmin.exe/si" To run in a single instance in command prompt.
2> To write a macro.

As I told you that i'am pretty weak in writing Macro so i'am finding bit difficult to code.
And as far as First Solution that is :\Cognos\cer2\bin\ImpAdmin.exe/si" , to run in command prompt, Its not working, Again its leads to same old problem.

I would be very great ful to you if you provide me the exact solution this problem if possible with the code.
Thank you,
With regards,
prashanth.

cognosfreelancer

Hi Prashanth

Below is the code snippet

---------------------------------------------------

option explicit
global ImpApp as object
global ImpRep_Check as object
on error goto errorhandler

' object initialization 
'-------------------------------------------------------------------------------------------------------
   set ImpApp = createobject("CognosImpromptu.application")
   ImpApp.visible true
   ImpApp.opencatalog "\\ridapp29\data\development\****.cat","user"


Comment - This macro uses a catalog where the database user id and password is embedded for the catalog user profile 'user'.

set ImpRep_Check = ImpApp.openreport ("Q:\data\development\****.imr",sale_date)

Comment - above line opens a report that accepts one parameter, if you do not have a parameter you can remove the second argument from the above function.

ImpRep_Check.closereport
set ImpRep_Check = nothing

quit_program:
ImpApp.quit
set ImpApp = nothing

exit sub

errorhandler:
     // do regular error handling routines.
     resume quit_program  ' -- this will correctly destroy all objects
     
end sub        '--  end of main program




-----------------------------------------------------------------------------------

HTH
NKT

ranjankumar

Hi your explantions is closer to my requirement .. but this code snippet need to place it in bat file is enough ? macro can be written in bat file ???

i could not catch up this line :

ImpApp.opencatalog "\\ridapp29\data\development\****.cat","user"

rlmarshall

you need to use the 'Cognos Script Editor' and put in the following code.

'*****************************************************************************************
'* Close any Open IM sessions
'* Close Open IM.mac
'*****************************************************************************************
'
'
'--------------------------------------------------------------------------------------------
'
Option Explicit
Sub Main()
   Dim objImpApp as Object
   Dim objImpCat as Object
   Dim objImpRep as Object
   Dim varDate   as Variant
   Dim msgtext   as String
'-------------------------------------------------------------------------------------------

   Set objImpApp = GetObject("CognosImpromptu.Application")
   objImpApp.Visible True
   Set objImpCat = objImpApp.ActiveCatalog
   Set objImpRep = objImpApp.ActiveDocument
   
' close everything
   on error resume next
   objImpRep.CloseReport
   Set objimprep = Nothing
   
   varDate  = CVar(Date)
   msgtext="The Open Impromptu session was closed at " & Format(varDate,"mmm dd yyyy ")
       
   objImpApp.Quit
   Set objImpApp=Nothing
 
End Sub
'*****************************************************************************************
save this code as " Close Open IM.mac "

Now you have two choices.

1. for every task in scheduler you will want to go to the edit the task that opens Impromptu and go to the 'Results' tab.
check the Command Script: option and enter the path and macro you just saved.

2. you can create a new task in scheduler to run this macro as often as needed, say hourly.