From: Amir Atary on
Hi there,

I have a very simple script:

msgbox "This is a test"

How can i make the msgbox to appear on top?
Sometimes our users work with a few application at once, and they cannot see
the message, unless it will be on top.

Thank you
Amir :)
From: Pegasus [MVP] on


"Amir Atary" <AmirAtary(a)discussions.microsoft.com> wrote in message
news:46E20FD1-DF4D-4F50-ABAA-606E3DE29A88(a)microsoft.com...
> Hi there,
>
> I have a very simple script:
>
> msgbox "This is a test"
>
> How can i make the msgbox to appear on top?
> Sometimes our users work with a few application at once, and they cannot
> see
> the message, unless it will be on top.
>
> Thank you
> Amir :)

I am not aware of a method that is native to VB Scripts that will do this.
You could walk around the problem by using msg.exe to generate the box. It
seems it is always on top, even when generated by a background process.

From: Tom Lavedas on
On Mar 4, 9:40 am, Amir Atary <AmirAt...(a)discussions.microsoft.com>
wrote:
> Hi there,
>
> I have a very simple script:
>
> msgbox "This is a test"
>
> How can i make the msgbox to appear on top?
> Sometimes our users work with a few application at once, and they cannot see
> the message, unless it will be on top.
>
> Thank you
> Amir :)

Something like this is all I can come up with ...

sTitle = "Testing"
with createobject("wscript.shell")
if wsh.arguments.count = 0 then
.run wsh.fullname & " """ & wsh.scriptfullname & """ 2nd", 1,
false
do until .appactivate(sTitle): wsh.sleep : loop
else
msgbox "This is a test", vbOKOnly, sTitle
end if
end with

It recursively calls the originating script and uses AppActivate to
bring it into focus. This does not mean it can't be covered up
later. That is. it is not an 'always on top' function. That's
considered 'rude' and can only be accomplished by calls to the OS API,
as I understand.

Note that an instance of a script cannot use this approach on itself
because the Msgbox stops the script's flow until it is released. It
can only be applied to another script or another instance of itself
(as I did above).
_____________________
Tom Lavedas