Jump to content

Why this script doesn't work properly?


Recommended Posts

#include <Process.au3>
#include <File.au3>
#include <GUIConstants.au3>
#Include <Misc.au3>



GUICreate("SCORTE REAGENTI IN FRIGORIFERO",600,534)
GUISetState() ; display the GUI

$input = GUICtrlCreateInput("", 110, 156, 150, 20)
ControlFocus ( "", "", $input )
$dll = DllOpen("user32.dll")

while 1
sleep(10)
    $msg = GUIGetMsg()
    
    $giorno =@mday
    $mese =-@mon
    $data = ($giorno & $mese)
    

    select 
        
        case  _IsPressed("0d",$dll) 
        
            $fico = GUICtrlRead($input)
                
            if   $fico = "1" then
                        
            $conteggio= _filewritetoline("hbsag.txt",1,"contami",0)
            $CountLines = _FileCountLines("hbsag.txt")
            _filewritetoline("TOTALE REATTIVI.txt",1,"HBSAG = " & $CountLines - 1)
            _filewritetoline("TOTALE REATTIVI.txt",2,"Data ultimo arrivo =  " &$data,1)
            sleep(250)
            $input = GUICtrlCreateInput("", 110, 156, 150, 20)
            ControlFocus ( "", "", $input )
            
            elseif  $fico = "2" then
            
            $conteggio= _filewritetoline("hcv.txt",1,"contami",0)
            $CountLines = _FileCountLines("hcv.txt")
            _filewritetoline("TOTALE REATTIVI.txt",3,"HCV = " & $CountLines - 1)
            _filewritetoline("TOTALE REATTIVI.txt",4,"Data ultimo arrivo =  " &$data,1)
            sleep(250)
            $input = GUICtrlCreateInput("", 110, 156, 150, 20)
            ControlFocus ( "", "", $input )

            elseif $fico = "3" then
            
            $conteggio= _filewritetoline("hiv.txt",1,"contami",0)
            $CountLines = _FileCountLines("hiv.txt")
            _filewritetoline("TOTALE REATTIVI.txt",5,"HIV = " & $CountLines - 1)
            _filewritetoline("TOTALE REATTIVI.txt",6,"Data ultimo arrivo =  " &$data,1)
            sleep(250)
            $input = GUICtrlCreateInput("", 110, 156, 150, 20)
            ControlFocus ( "", "", $input )
            
            endif

        case  $msg = $GUI_EVENT_CLOSE 
        exitloop
        
  endselect

WEnd
DllClose($dll)
exit


GUIDelete()

I attach my folder .. when i try to use this script line in TOTALE REATTIVI.txt are all wrong and in " hbsag.txt" or "hiv.txt" under end , line take life!!!!!!! why?

Edited by ficofico
Link to comment
Share on other sites

Can you post an example of what you want it to do and what it is actually doing? I need to know what you want the program to do in order to fix it.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

#include <Process.au3>
#include <File.au3>
#include <GUIConstants.au3>
#Include <Misc.au3>



GUICreate("SCORTE REAGENTI IN FRIGORIFERO",600,534)
GUISetState(); display the GUI

$input = GUICtrlCreateInput("", 110, 156, 150, 20)
ControlFocus ( "", "", $input )
$dll = DllOpen("user32.dll")

while 1
sleep(10)
    $msg = GUIGetMsg()
    
    $giorno =@mday
    $mese =-@mon
    $data = ($giorno & $mese)
    

    select
        
        case  _IsPressed("0d",$dll)
        
            $fico = GUICtrlRead($input)
                
            if   $fico = "1" then
                        
            $conteggio= _filewritetoline(@scriptdir&"\hbsag.txt",1,"contami",0)
            $CountLines = _FileCountLines(@scriptdir&"\hbsag.txt")
            _filewritetoline(@scriptdir&"\TOTALE REATTIVI.txt",1,"HBSAG = " & $CountLines - 1)
            _filewritetoline(@scriptdir&"\TOTALE REATTIVI.txt",2,"Data ultimo arrivo =  " &$data,1)
            sleep(250)
            $input = GUICtrlCreateInput("", 110, 156, 150, 20)
            ControlFocus ( "", "", $input )
            
            elseif   $fico = "2" then
            
            $conteggio= _filewritetoline(@scriptdir&"\hcv.txt",1,"contami",0)
            $CountLines = _FileCountLines(@scriptdir&"\hcv.txt")
            _filewritetoline(@scriptdir&"\TOTALE REATTIVI.txt",3,"HCV = " & $CountLines - 1)
            _filewritetoline(@scriptdir&"\TOTALE REATTIVI.txt",4,"Data ultimo arrivo =  " &$data,1)
            sleep(250)
            $input = GUICtrlCreateInput("", 110, 156, 150, 20)
            ControlFocus ( "", "", $input )

            elseif $fico = "3" then
            
            $conteggio= _filewritetoline(@scriptdir&"\hiv.txt",1,"contami",0)
            $CountLines = _FileCountLines(@scriptdir&"\hiv.txt")
            _filewritetoline(@scriptdir&"\TOTALE REATTIVI.txt",5,"HIV = " & $CountLines - 1)
            _filewritetoline(@scriptdir&"\TOTALE REATTIVI.txt",6,"Data ultimo arrivo =  " &$data,1)
            sleep(250)
            $input = GUICtrlCreateInput("", 110, 156, 150, 20)
            ControlFocus ( "", "", $input )
            
            endif

        case  $msg = $GUI_EVENT_CLOSE
        exitloop
        
  endselect

WEnd
DllClose($dll)
exit


GUIDelete()

Try that?

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

Can you post an example of what you want it to do and what it is actually doing? I need to know what you want the program to do in order to fix it.

I want to have a list of the reagent in a laboratory. When I check-in a ref barcode reagent, script have to add a line in the txt file corrispondent reagent and count the line and write how many reagent there's in lab. I've also create a " delete gui", that eliminate a line in the corrispondent txt reagent file.

Now do that, but it's very crazy, and line are not true as script

example

HBSAG = 3

Data ultimo arrivo = 08-7

HCV = 3

Data ultimo arrivo = 08-7

HIV = 4

Data ultimo arrivo = 08-7

HIV = 3

Data ultimo arrivo = 08-7

HIV = 2

Data ultimo arrivo = 08-7

Data ultimo arrivo = 08-7

HIV = 1

Data ultimo arrivo = 08-7

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...