You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mario Madunic <ha...@imag.net> on 2007/10/25 15:36:28 UTC

possible to open an alert window?

Was wondering if it is possible to open an alert window? What I want to do is
change an alert via <echo> because some users are missing it and have an alert
window open stating that there is an error log to view. So far I the code checks
to see the size of an error log and if its file size is greater than 0 then
output an message on the command window, if not then delete the file.


<length file="error\artError${l_Docset}.txt" property="articleErrorFileSize" />

  <if>
    <equals arg1="${reviewErrorFileSize}" arg2="0" />
    <then>
      <delete file="error\revError${l_Docset}.txt" />
    </then>
    <else>
      <echo />
      <echo>There where errors during ingest into the database of the reviews
for ${l_Docset}</echo>
      <echo>Please review the following error file:
error\revError${l_Docset}.txt</echo>
      <echo />
    </else>
  </if>

The other idea I have if I can't open an alerter window is to open the file
using notepad.

Any help will be appreciated.

Using ANT 1.7
Windows XP
Java 1.6

Thanks

Marijan (Mario) Madunic

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: possible to open an alert window?

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
Hi, Peter

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: Friday, October 26, 2007 11:32 AM
To: Ant Users List
Subject: Re: possible to open an alert window?

/*

easy:
<project name="$1" default="build">
  <target name="run">
    <script language="beanshell">
      import javax.swing.*;
      new Thread() {
        public void run() {
          JOptionPane.showMessageDialog(
              null, "A long and boring message",
              "Danger Danger", JOptionPane.ERROR_MESSAGE);
        }
      }.start();
    </script>

    <..... the rest of the build ...>

  </target>
</project>

*/

that doesn't work for me with
Ant 1.6.5, beanshell 2.0b4, bsf 2.3.0_rc1

The build runs through but no JOptionPane gets
opened.

The snippet with the class Waiter { } open a JOptionPane
but is just blocking the build, as it does without the whole thread
handling.

Sorry i don't get the point, maybe it doesn't work here
because of my (old) version of Ant and/or Bsf ?!?

You' ve tried it with Ant 1.6.5  also ?


To prevent from blocking the build i would use the antcontrib
<limit> task or do it with a timeout like that =

<property name="waitfor" value="20"/>
...

<script language="ruby">
<![CDATA[
 require 'timeout'
 include Java
        
 begin
   Timeout.timeout($waitfor.to_i) {
     javax.swing.JOptionPane.showMessageDialog(
     nil, "A long and boring message",
     "Danger Danger", javax.swing.JOptionPane::ERROR_MESSAGE)
    }
 rescue Timeout::Error
   puts "JOptionPane closed due to inactivity after waiting #{$waitfor}
seconds !!"
 end
]]>
</script>


Regards, Gilbert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: possible to open an alert window?

Posted by Peter Reilly <pe...@gmail.com>.
easy:
<project name="$1" default="build">
  <target name="run">
    <script language="beanshell">
      import javax.swing.*;
      new Thread() {
        public void run() {
          JOptionPane.showMessageDialog(
              null, "A long and boring message",
              "Danger Danger", JOptionPane.ERROR_MESSAGE);
        }
      }.start();
    </script>

    <..... the rest of the build ...>

  </target>
</project>

at the end of the build the dialog will get killed, if you wait to wait for
the dialog to be removed do:
    <script language="beanshell">
      import javax.swing.*;
      class Waiter {
        private boolean done = false;
        public synchronized void doWait() {
          if (done) {
             return;
          }
          wait();
        }
        public synchronized void doDone() {
            done = true;
            notifyAll();
        }
      }
      w = new Waiter();
      t = new Thread() {
        public void run() {
          JOptionPane.showMessageDialog(
              null, "A long and boring message",
              "Danger Danger", JOptionPane.ERROR_MESSAGE);
              w.doDone();
        }
      };
      t.start();
      project.addReference("wait.for.me", w);
    </script>

    <echo> HELLO WORLD</echo>
    <script language="beanshell">
      project.getReference("wait.for.me").doWait();
    </script>

Peter

On 10/26/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
>
> an important difference is, that calling a SwingDialog with
> script is blocking the build, whereas the exec doesn't block
> the build.
>
> So if you don't want to block the build you have to use
> antcontrib limit task =
>
> <limit maxwait="10">
> <script ...>
> ...
> </script>
>
> </limit>
>
> or is there another way  ?
>
>
> Regards, Gilbert
>
> -----Original Message-----
> From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com]
> Sent: Thursday, October 25, 2007 4:52 PM
> To: Ant Users List
> Subject: Re: possible to open an alert window?
>
> or use <script>
>     <script language="beanshell">
>       import javax.swing.*;
>       JOptionPane.showMessageDialog(
>           null, "A long and boring message",
>          "Danger Danger", JOptionPane.ERROR_MESSAGE);
>     </script>
>
> Peter
>
>
> On 10/25/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
> >
> >
> > -----Original Message-----
> > From: Mario Madunic [mailto:hajduk@imag.net]
> > Sent: Thursday, October 25, 2007 3:36 PM
> > To: user@ant.apache.org
> > Subject: possible to open an alert window?
> >
> > /*
> >
> > Was wondering if it is possible to open an alert window? What I want
> to
> > do is
> > change an alert via <echo> because some users are missing it and have
> an
> > alert
> > window open stating that there is an error log to view. So far I the
> > code checks
> > to see the size of an error log and if its file size is greater than 0
> > then
> > output an message on the command window, if not then delete the file.
> > */
> >
> > once used net send in a windows LAN to prevent sending emails like
> that
> > =
> >
> > 1. template
> > a file netsendbase.txt, must be all on one line !! =
> >
> > FOR /F %%i in (netsend_to.txt) do @Net Send %%i CruiseControlMessage :
> > Build  *@project@ * successful - Please start * @toStart@ * asap !!
> >
> > 2. configure recipients
> > a file netsend_to.txt, with 1 recipient per line =
> >
> > userID1
> > userID2
> > buildadmin1
> > ...
> >
> > 3. ant part
> >
> > <delete file="./bat/netsend.bat"/>
> > <filter token="project" value="${projectname}"/>
> >  <filter token="toStart" value="${tostart}"/>
> > <copy file="./bat/netsendbase.txt" tofile="./bat/netsend.bat"
> > filtering="true"/>
> >
> > <exec dir="./bat" executable="cmd.exe" os="Windows 2000">
> >   <arg line="/c netsend.bat"/>
> > </exec>
> >
> > as alternative, if you need to 'decorate' your ant script with
> > interactive
> > gui's then use AntForm, see =
> > http://antforms.sourceforge.net/
> >
> > Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: possible to open an alert window?

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
an important difference is, that calling a SwingDialog with
script is blocking the build, whereas the exec doesn't block
the build.

So if you don't want to block the build you have to use
antcontrib limit task =

<limit maxwait="10">
<script ...>
...
</script>

</limit>

or is there another way  ?


Regards, Gilbert 

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: Thursday, October 25, 2007 4:52 PM
To: Ant Users List
Subject: Re: possible to open an alert window?

or use <script>
    <script language="beanshell">
      import javax.swing.*;
      JOptionPane.showMessageDialog(
          null, "A long and boring message",
         "Danger Danger", JOptionPane.ERROR_MESSAGE);
    </script>

Peter


On 10/25/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
>
>
> -----Original Message-----
> From: Mario Madunic [mailto:hajduk@imag.net]
> Sent: Thursday, October 25, 2007 3:36 PM
> To: user@ant.apache.org
> Subject: possible to open an alert window?
>
> /*
>
> Was wondering if it is possible to open an alert window? What I want
to
> do is
> change an alert via <echo> because some users are missing it and have
an
> alert
> window open stating that there is an error log to view. So far I the
> code checks
> to see the size of an error log and if its file size is greater than 0
> then
> output an message on the command window, if not then delete the file.
> */
>
> once used net send in a windows LAN to prevent sending emails like
that
> =
>
> 1. template
> a file netsendbase.txt, must be all on one line !! =
>
> FOR /F %%i in (netsend_to.txt) do @Net Send %%i CruiseControlMessage :
> Build  *@project@ * successful - Please start * @toStart@ * asap !!
>
> 2. configure recipients
> a file netsend_to.txt, with 1 recipient per line =
>
> userID1
> userID2
> buildadmin1
> ...
>
> 3. ant part
>
> <delete file="./bat/netsend.bat"/>
> <filter token="project" value="${projectname}"/>
>  <filter token="toStart" value="${tostart}"/>
> <copy file="./bat/netsendbase.txt" tofile="./bat/netsend.bat"
> filtering="true"/>
>
> <exec dir="./bat" executable="cmd.exe" os="Windows 2000">
>   <arg line="/c netsend.bat"/>
> </exec>
>
> as alternative, if you need to 'decorate' your ant script with
> interactive
> gui's then use AntForm, see =
> http://antforms.sourceforge.net/
>
> Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: possible to open an alert window?

Posted by Rob Wilson <ne...@gmail.com>.
That's a very useful tip!

On 10/25/07, Peter Reilly <pe...@gmail.com> wrote:
>
> or use <script>
>    <script language="beanshell">
>      import javax.swing.*;
>      JOptionPane.showMessageDialog(
>          null, "A long and boring message",
>         "Danger Danger", JOptionPane.ERROR_MESSAGE);
>    </script>
>
> Peter
>

RE: possible to open an alert window?

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 
Hi,

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: Thursday, October 25, 2007 4:52 PM
To: Ant Users List
Subject: Re: possible to open an alert window?

/*

or use <script>
    <script language="beanshell">
      import javax.swing.*;
      JOptionPane.showMessageDialog(
          null, "A long and boring message",
         "Danger Danger", JOptionPane.ERROR_MESSAGE);
    </script>

*/

neat !!

the same with ruby for people like me ;-) 

<script language="ruby">
<![CDATA[
include Java
javax.swing.JOptionPane.showMessageDialog(
   nil, "A long and boring message",
   "Danger Danger", javax.swing.JOptionPane::ERROR_MESSAGE)
]]>
</script>

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: possible to open an alert window?

Posted by Mario Madunic <ha...@imag.net>.
Thanks that is great.

Marijan (Mario) Madunic

Quoting Peter Reilly <pe...@gmail.com>:

> or use <script>
>     <script language="beanshell">
>       import javax.swing.*;
>       JOptionPane.showMessageDialog(
>           null, "A long and boring message",
>          "Danger Danger", JOptionPane.ERROR_MESSAGE);
>     </script>
> 
> Peter
> 
> 
> On 10/25/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
> >
> >
> > -----Original Message-----
> > From: Mario Madunic [mailto:hajduk@imag.net]
> > Sent: Thursday, October 25, 2007 3:36 PM
> > To: user@ant.apache.org
> > Subject: possible to open an alert window?
> >
> > /*
> >
> > Was wondering if it is possible to open an alert window? What I want to
> > do is
> > change an alert via <echo> because some users are missing it and have an
> > alert
> > window open stating that there is an error log to view. So far I the
> > code checks
> > to see the size of an error log and if its file size is greater than 0
> > then
> > output an message on the command window, if not then delete the file.
> > */
> >
> > once used net send in a windows LAN to prevent sending emails like that
> > =
> >
> > 1. template
> > a file netsendbase.txt, must be all on one line !! =
> >
> > FOR /F %%i in (netsend_to.txt) do @Net Send %%i CruiseControlMessage :
> > Build  *@project@ * successful - Please start * @toStart@ * asap !!
> >
> > 2. configure recipients
> > a file netsend_to.txt, with 1 recipient per line =
> >
> > userID1
> > userID2
> > buildadmin1
> > ...
> >
> > 3. ant part
> >
> > <delete file="./bat/netsend.bat"/>
> > <filter token="project" value="${projectname}"/>
> >  <filter token="toStart" value="${tostart}"/>
> > <copy file="./bat/netsendbase.txt" tofile="./bat/netsend.bat"
> > filtering="true"/>
> >
> > <exec dir="./bat" executable="cmd.exe" os="Windows 2000">
> >   <arg line="/c netsend.bat"/>
> > </exec>
> >
> > as alternative, if you need to 'decorate' your ant script with
> > interactive
> > gui's then use AntForm, see =
> > http://antforms.sourceforge.net/
> >
> > Regards, Gilbert
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: possible to open an alert window?

Posted by Peter Reilly <pe...@gmail.com>.
or use <script>
    <script language="beanshell">
      import javax.swing.*;
      JOptionPane.showMessageDialog(
          null, "A long and boring message",
         "Danger Danger", JOptionPane.ERROR_MESSAGE);
    </script>

Peter


On 10/25/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
>
>
> -----Original Message-----
> From: Mario Madunic [mailto:hajduk@imag.net]
> Sent: Thursday, October 25, 2007 3:36 PM
> To: user@ant.apache.org
> Subject: possible to open an alert window?
>
> /*
>
> Was wondering if it is possible to open an alert window? What I want to
> do is
> change an alert via <echo> because some users are missing it and have an
> alert
> window open stating that there is an error log to view. So far I the
> code checks
> to see the size of an error log and if its file size is greater than 0
> then
> output an message on the command window, if not then delete the file.
> */
>
> once used net send in a windows LAN to prevent sending emails like that
> =
>
> 1. template
> a file netsendbase.txt, must be all on one line !! =
>
> FOR /F %%i in (netsend_to.txt) do @Net Send %%i CruiseControlMessage :
> Build  *@project@ * successful - Please start * @toStart@ * asap !!
>
> 2. configure recipients
> a file netsend_to.txt, with 1 recipient per line =
>
> userID1
> userID2
> buildadmin1
> ...
>
> 3. ant part
>
> <delete file="./bat/netsend.bat"/>
> <filter token="project" value="${projectname}"/>
>  <filter token="toStart" value="${tostart}"/>
> <copy file="./bat/netsendbase.txt" tofile="./bat/netsend.bat"
> filtering="true"/>
>
> <exec dir="./bat" executable="cmd.exe" os="Windows 2000">
>   <arg line="/c netsend.bat"/>
> </exec>
>
> as alternative, if you need to 'decorate' your ant script with
> interactive
> gui's then use AntForm, see =
> http://antforms.sourceforge.net/
>
> Regards, Gilbert
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: possible to open an alert window?

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 

-----Original Message-----
From: Mario Madunic [mailto:hajduk@imag.net] 
Sent: Thursday, October 25, 2007 3:36 PM
To: user@ant.apache.org
Subject: possible to open an alert window?

/*

Was wondering if it is possible to open an alert window? What I want to
do is
change an alert via <echo> because some users are missing it and have an
alert
window open stating that there is an error log to view. So far I the
code checks
to see the size of an error log and if its file size is greater than 0
then
output an message on the command window, if not then delete the file.
*/

once used net send in a windows LAN to prevent sending emails like that
=

1. template
a file netsendbase.txt, must be all on one line !! =

FOR /F %%i in (netsend_to.txt) do @Net Send %%i CruiseControlMessage :
Build  *@project@ * successful - Please start * @toStart@ * asap !!

2. configure recipients
a file netsend_to.txt, with 1 recipient per line =

userID1
userID2
buildadmin1
...

3. ant part

<delete file="./bat/netsend.bat"/>
<filter token="project" value="${projectname}"/>
 <filter token="toStart" value="${tostart}"/>
<copy file="./bat/netsendbase.txt" tofile="./bat/netsend.bat"
filtering="true"/>

<exec dir="./bat" executable="cmd.exe" os="Windows 2000">
  <arg line="/c netsend.bat"/>
</exec>

as alternative, if you need to 'decorate' your ant script with
interactive
gui's then use AntForm, see =
http://antforms.sourceforge.net/

Regards, Gilbert







---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: possible to open an alert window?

Posted by Steve Loughran <st...@apache.org>.
Mario Madunic wrote:
> Was wondering if it is possible to open an alert window? What I want to do is
> change an alert via <echo> because some users are missing it and have an alert
> window open stating that there is an error log to view. So far I the code checks
> to see the size of an error log and if its file size is greater than 0 then
> output an message on the command window, if not then delete the file.
> 
> 
> <length file="error\artError${l_Docset}.txt" property="articleErrorFileSize" />
> 
>   <if>
>     <equals arg1="${reviewErrorFileSize}" arg2="0" />
>     <then>
>       <delete file="error\revError${l_Docset}.txt" />
>     </then>
>     <else>
>       <echo />
>       <echo>There where errors during ingest into the database of the reviews
> for ${l_Docset}</echo>
>       <echo>Please review the following error file:
> error\revError${l_Docset}.txt</echo>
>       <echo />
>     </else>
>   </if>
> 

thinking about this some more, the <splash> task can be used to bring up 
an image from in a URL. If you can somehow create an image with your 
text, <splash> can display it for you


-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org