Ajouter un commentaire

gethy06

Voici ma boucle :

   while(true)
   {
       int i=0;
       String NomFile=com+"-"+dat+hour+min+sec+milsec;
       System.out.println("Nouveau fichier txt créé : "+NomFile);
       FileWriter txt = null;
       String titretxt="C:/flasheur/txt/"+NomFile+".txt";
       txt = new FileWriter(titretxt);
       PrintWriter pretxt = new PrintWriter(txt);
       pretxt.flush();
       //Attente de 30 min (le temps est en ms)
       serialPort.enableReceiveTimeout(1800000);
       System.out.println(dat+hour+min+sec+milsec);
       try
       {
           do
           {
               //pour lire avec des streams:
               in=new BufferedReader(new InputStreamReader(serialPort.getInputStream()));
               int amount;
               String c="";
               do
               {
                   amount = in.read();
                   c+=DecToChar(amount);
               }while(DecToChar(amount)!="ETX");
              System.out.println(c);
              if(c.length()==38)
              {
                  String barcode=c.substring(19, 27);
                  pretxt.println("BARCODE="+barcode+";DATETIME="+dat+hour2+min2+sec2+milsec2);
                  pretxt.flush();
                  i++;
              }
              if(i==30)
              {
                  ok=false;
              }
              if(c.compareTo("STXCLOTURE_HILLSETX")==0)
              {
                  System.out.println("CLOTURE DE LA JOURNEE");
                  ok=false;
               }
            }while(ok);
            pretxt.close();
            System.out.println("Nouveau fichier BOUCHON créé : "+NomFile);
            FileWriter bch = null;
            String titrebch="C:/flasheur/txt/"+NomFile+".bouchon";
            bch = new FileWriter(titrebch);
            PrintWriter prebch = new PrintWriter(bch);
            prebch.flush();
            prebch.close();
            envoieFTP(NomFile);
            Properties sys = System.getProperties();
            String os = sys.getProperty("os.name");
            Runtime r = Runtime.getRuntime();
            try
           {
               r.exec("C:/flasheur/start.bat");
           }
           catch (IOException ex)
           {
               ex.printStackTrace();
           } 
           in.close();
       }
       catch(Exception f)
       {
           System.out.println("----Nouveau fichier BOUCHON créé : "+NomFile);
           FileWriter bch = null;
           String titrebch="C:/flasheur/txt/"+NomFile+".bouchon";
           bch = new FileWriter(titrebch);
           PrintWriter prebch = new PrintWriter(bch);
           prebch.flush();
           prebch.close();
           envoieFTP(NomFile);
       }
     }

Une petite question :
J'ai fais en sorte que le programme se lance au lancement d'une session windows grace à un .bat.
Ma question est : Apres verrouillage de la session, quand on se reconnecte a celle-ci, l'invite de cimmande est toujours presente mais le programme cess-t-il de fonctionner ?

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
 N   N  RRRR       J  ZZZZZ   GGG  
NN N R R J Z G
N N N RRRR J Z G GG
N NN R R J J Z G G
N N R RR JJJ ZZZZZ GGG