Shell function in ReportScript

I am curious to see if anyone has accomplished what Jean-Michel is asking below. We have the same need. We also could not find any kind of a “sleep” script command.

Attached is a script showing how we accomplished this. Basically, we have the shelled-to command create a flag file when it is complete. Our script loops for five seconds, then checks for the existence of the flag file. If it is not there, loop some more and keep checking until the flag file exists (up to 10 minutes in our case). The attachment shows more detail.

<<Boibitm.spt>>
Not great, but it works. If anyone has any better ideas, I would love to hear them.

Dick McConnell
Polymerland

From: Houmard Jean-Michel[SMTP:Jean-Michel.Houmard@BAKOM.ADMIN.CH]
Sent: Monday, September 21, 1998 11:46 AM

Hi,
I have a script which starts some OS commands with the shell function. Actually, when the function is started, BO script does not wait until the OS command has finished (= asynchronous).

Is it possible to start the shell function in wait mode (synchronous)?

When not, I can wait in a “while loop”. But I did not found a timer function to wait, sleep or idle the script.
Is it possible to force a scripts to wait?

Best regards

Jean-Michel

For old 3.1 info: Penn: Page not found
Search: Mail to listserv@listserv.aol.com, ‘search a_phrase in BUSOB-L’
Unsubscribe: Mail to listserv@listserv.aol.com, ‘unsubscribe BUSOB-L’

begin 600 Boibitm.spt
M4W5B(&UA:6X-“B@($1I;2!X#0H@("!$:6T@=T*(”@#0H@("G9&5L971E M('1H92!O;&0@9&%T82!F:6QE(&9I<G-T.@T*(“@;VX@97)R;W(@<F5S=6UE M(&amp;YE>'0-"B@(&MI;&P@(F4Z7&)O:5]A8V-E<W-<8F]I8FET96TN9&)F(@T* M(”@#0H@("G8W)E871E('1H92!N97<@9&%T869I;&4Z#0H@(“!X/5-H96QL M*”)C.EQM<V]F9FEC95QA8V-E<W-<;7-A8V-E<W,N97AE(&4Z7$)/25]!8V-E M<W-<0D])0FET;2YM9&(@+U@@;6%C0DET96U’96XB0T(“@#0IW86ET7VQO M;WZ#0H@(“G;&amp;]O<"!F;W(@9FEV92!S96-O;F1S('1O(&amp;=I=F4@=&amp;AE(&amp;%C M8V5S<R!R=&amp;X@=&amp;EM92!T;R!C<F5A=&amp;4@=&amp;AE(&amp;YE=R!D871A(&amp;9I;&amp;4Z#0H@ M("!S=&amp;%R="](%1I;65R#0H@(”!$;R!7:&EL92!4:6UE<B\(%-T87)T("L@ M-2@(”=L;V]P(&9O<BU('-E8V]N9',-"B@(“@($1O179E;G1S#0H@("!, M;V]P#0H@("!C;G0@/2!C;G0@*RQ#0H@(”!I9B!C;G0@/BR,#@=&AE;B@ M("=K965P('1R>6EN9R!F;W(@,3@;6EN=71E<PT*(“@("@97AI=”!S=6(- M"B@(&amp;5N9"!I9@T*("@#0H@(“G8VAE8VL@=&amp;\@<V5E(&amp;EF(&amp;1A=&amp;$@9FEL M92!H87,@8F5E;B!C<F5A=&amp;5D('EE=#L@:68@;F]T+"!L;V]P(&amp;9O<B!A;F]T M:&amp;5R(#4@<V5C;VYD<SH-"B@('0]1FEL941A=&54:6UE*”)E.EQB;VE?86-C M97-S7&)O:6)I=&5M+F1B9B(I#0H@(“!I9B!E<G(@/#X@,”!T:&5N#0H@(“@ M("!E<G(@/2P#0H@(”@("!G;W1O('=A:71?;&amp;]O<T*(“@96YD(&amp;EF#0H@ -("-“D5N9”!3=6(-”@==
`
end


Listserv Archives (BOB member since 2002-06-25)

Hi,
I have a script which starts some OS commands with the shell function. Actually, when the function is started, BO script does not wait until the OS command has finished (= asynchronous).

Is it possible to start the shell function in wait mode (synchronous)?

When not, I can wait in a “while loop”. But I did not found a timer function to wait, sleep or idle the script. Is it possible to force a scripts to wait?

Best regards

Jean-Michel


Listserv Archives (BOB member since 2002-06-25)

In a message dated 9/21/1998, 10:49:06 AM, BUSOB-L@LISTSERV.AOL.COM writes: <<We also could not find any kind of a “sleep” script command.>>

BusinessObjects does not provide one, but Windows does. You can call Win32 functions as long as you declare them… similar to what you can do in VB. Check for syntax, but the declaration should look something like:

Declare Sub Sleep Lib “kernel32” Alias “Sleep” (ByVal dwMilliseconds as Long)

and then call it as:

call Sleep(5000)

The declaration makes the function available, the call invokes it. The argument is the number of milliseconds, whichs makes the call example a sleep for five seconds. By declaring the Windows kernel32.dll as an external source for functions, you can call most (if not all) of the functions in the Windows API. Now to my question: if anyone is aware of a good source on the web for documentation of these functions and their syntax, I would love to hear about it!

Regards,
Dave Rathbun
Integra Solutions
www.islink.com


Listserv Archives (BOB member since 2002-06-25)

If you have Visual Basic, it comes with API utilities that you can select the functions, constants, and so and and it will paste them into the clipboard and you just paste them into your script already defined. I have a book from PC Magazine the goes over the Win32 API very good. Since it is written for VB it can easily be adapted for BusinessObjects scirpting language. Below is code we use in VB to shell out to a program and wait till it is finished and also the declares that you need for it.

Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = &HFFFF ’ Infinite timeout
Private Declare Function OpenProcess Lib “kernel32” (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long Private Declare Function CloseHandle Lib “kernel32” (ByVal hObject As Long)
As Long
Private Declare Function WaitForSingleObject Lib “kernel32” (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Sub RunWinWait(ByVal CommandLine As String, ByVal CommandControl As Integer, Optional ByVal Seconds)
'CommandLine is the command to run and any paramters. 'CommandControl is one of the following: ’
’ vbHide 0 Window is hidden and focus is passed to the
hidden window.
’ vbNormalFocus 1 Window has focus and is restored to its
original size and position.
’ vbMinimizedFocus 2 Window is displayed as an icon with focus. ’ vbMaximizedFocus 3 Window is maximized with focus. ’ vbNormalNoFocus 4 Window is restored to its most recent size and
position. The currently active window remains active. ’ vbMinimizedNoFocus 6 Window is displayed as an icon. The currently active window remains active.

'Seconds is the number of seconds to wait before control returns to calling
routine.

Dim WaitSeconds As Long

If IsMissing(Seconds) Then
WaitSeconds = 0
Else
WaitSeconds = Seconds
End If

'Process ID
Dim pid&
'Process handle
Dim phnd&

pid = Shell(CommandLine, CommandControl) If pid <> 0 Then
phnd = OpenProcess(SYNCHRONIZE, 0, pid)
If phnd <> 0 Then
If WaitSeconds > 0 Then
Call WaitForSingleObject(phnd, WaitSeconds * 1000) Else
Call WaitForSingleObject(phnd, INFINITE) End If
Call CloseHandle(phnd)
End If
End If
End Sub

Glenn Fredericks
Data Warehouse Specialist
glenn_fredericks@aal.org
(920) 730-4700 x4236 or 1-800 CALL AAL

Aid Association for Lutherans
4321 N. Ballard Road
Appleton, WI 54919-0001
Visit our Web site at www.aal.org or e-mail us at aalmail@aal.org

AAL… Financial services. Lutheran heritage. A powerful combination.


Listserv Archives (BOB member since 2002-06-25)