Jump to content

AutoIT GUI Input to search data


Recommended Posts

Greetings fellow autoit forum members,

I am trying to create a system that will automate my job even more and i stumbled upon a difficulty.

I am working in a police department which is responsible for all the prisoner transfers that take place fromour city.

My job is to get the numbers of prisoners being transported and send mails to all the departments where the transport will go through. That is the easy part which i have already automated. 

The way i get these numbers is that an other officer who works at a near office gives me some papers every day . For example if we are to transport prisoners to Place "B" he gives me the date , number of prisoners, time and at which prisons we are going to leave prisoners. I put these in a gui and send the mails automatically. 

So i thought "instead of giving me every day the numbers, i ll create an autoit executable where he can select the place (from a map) type the numbers instead of writing them down and press the button to submit" Then my autoit in my computer will read that there is a new file and also the numbers inside and will start sending the mail (so i dont have to enter the variables in my previous autoit gui)

The difficulty i stumbled upon is that normally we have a database that he searches through to see if a prisoner is extremely dangerous, and when he finds a prisoner who is dangerous (doesnt happen to often but twice or three times a week) he prints it out so i write his details along with the other numbers. I have created the system for him with a map that he can put the variables instead of writing them down but i cant figure out how i can implement the database in the autoitgui. 

So my problem is that i want him to search through autoit for the dangerous prisoners  and if he finds a hit that will be passed to the other inputs of the gui. What and how do you guys think i should do that? I though through Excel Maybe (moving the database to excel and then having AUTOIT rangeread all the data until it finds the match)

The other thing is to do most of the things in VBA and sql in already existing access database (creating forms and all necessary things) and then only having the autoit from my side to read if there is any new document

What would you do , which way would you take?

Here is my code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIDateTimePicker.au3>
#include <Word.au3>

Global $background = @ScriptDir & "\greece.jpg"
Func Form()
Local $Form1 = GUICreate("Form1", 956, 560, 192, 124)
Local $Button1 = GUICtrlCreateButton("ΔΙΚΗ ΜΑΣ", 160, 224, 241, 81)
Local $Button2 = GUICtrlCreateButton("ΕΠΙΣΤΡΟΦΗ", 536, 224, 241, 81)

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
            Case $Button1
                ; Disable the first GUI
                ; Re-enable the first GUI
EndFunc   ;==>gui1

    Func DIKI_MAS()
$Form2= GUICreate("ΔΙΚΕΣ ΜΑΣ ΜΕΤΑΓΩΓΕΣ",1280,700,192,124)
 $XANIA = GUICtrlCreateButton("ΧΑΝΙΑ",615,620,80,50)

GUICtrlCreatePic ($background,0,0,1280,700)

While 1
        ; We can only get messages from the second GUI
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
             Case $XANIA
                $XANIAFORM = GuiCreate("ΣΥΜΠΛΗΡΩΣΕ ΤΑ ΑΠΑΡΑΙΤΗΤΑ ΣΤΟΙΧΕΙΑ",600,600,600,600)
                  $EIDOSMETAG = GUICtrlCreateCombo("Τακτική|Εκτακτη",10,20,100,130)
                  $DAY = GUICtrlCreateCombo (" Ημερα",120,20,100,130)
                  $DATE = GUICtrlCreateDate("Ημερομηνία   Μεταγωγής",230,20,100,30)
                  $PLOIO = GUICtrlCreateCombo("ΠΛΟΙΟ",335,20,100,30)
                  $ATOMA = GUICtrlCreateCombo("Συνολο μεταγομενων κρατουμένων",10,55,200,30)
                  $ATOMA1 = GUICtrlCreateCombo("Συνολο μεταγομενων κρατουμένων",10,100,200,30)
                  $TOPOS1 = GUICtrlCreateLabel ("προς Κ.Κ. Χανίων",220,100,100,50)
                  $CHECK1 = GUICtrlCreateCheckbox ("ΚΛΙΚ ΕΔΩ", 320,90,100,30)
                  $ATOMA2 = GUICtrlCreateCombo("Συνολο μεταγομενων κρατουμένων",10,140,200,30)
                  $TOPOS2 = GUICtrlCreateLabel ("προς Λ.Κ.Κ. Αγίας",220,140,100,50)
                  $CHECK2 = GUICtrlCreateCheckbox ("ΚΛΙΚ ΕΔΩ", 320,121,100,50)
                    $btn = GUICtrlCreateButton ("ΚΑΤΑΧΩΡΗΣΗ", 500,400,100,50)

  GUICtrlSetData($EIDOSMETAG, "τακτική | έκτακτη")
                  GUICtrlSetData($DAY," Δευτέρα | Τρίτη | Τετάρτη | Πέμπτη | Παρασκευή | Σάββατο | Κυριακή")
                  GUICtrlSetData($PLOIO," Blue Star 1 | EΛΥΡΟΣ | BLUE STAR PAROS | BLUE STAR NAXOS | MINOAN LINES | ANEK LINES | Κυριακή")
                  GUICtrlSetData($ATOMA,"  |ενας (1)|δύο (2)|τρεις (3)|τέσσερις (4)|πέντε  (5)|έξι (6)|επτά (7)|οκτώ (8)|εννιά (9)|δέκα (10)|έντεκα (11)|δώδεκα (12)|δεκατρείς (13)|δεκατέσσερις (14)|δεκαπέντε (15)|δεκαέξι (16)|δεκαεπτά (17)|δεκαοκτώ (18)|δεκαεννιά (19)|είκοσι(20)|είκοσι-ένα (21)|είκοσι -δύο (22)|είκοσι-τρεις (23)|είκοσι -τέσσερις (24)|είκοσι-πέντε  (25)|είκοσι -έξι (26)|είκοσι-επτά (27)|είκοσι -οκτώ (28)")
                  GUICtrlSetData($ATOMA1,"  |ενας (1)|δύο (2)|τρεις (3)|τέσσερις (4)|πέντε  (5)|έξι (6)|επτά (7)|οκτώ (8)|εννιά (9)|δέκα (10)|έντεκα (11)|δώδεκα (12)|δεκατρείς (13)|δεκατέσσερις (14)|δεκαπέντε (15)|δεκαέξι (16)|δεκαεπτά (17)|δεκαοκτώ (18)|δεκαεννιά (19)|είκοσι(20)|είκοσι-ένα (21)|είκοσι -δύο (22)|είκοσι-τρεις (23)|είκοσι -τέσσερις (24)|είκοσι-πέντε  (25)|είκοσι -έξι (26)|είκοσι-επτά (27)|είκοσι -οκτώ (28)")
                  GUICtrlSetData($ATOMA2,"  |ενας (1)|δύο (2)|τρεις (3)|τέσσερις (4)|πέντε  (5)|έξι (6)|επτά (7)|οκτώ (8)|εννιά (9)|δέκα (10)|έντεκα (11)|δώδεκα (12)|δεκατρείς (13)|δεκατέσσερις (14)|δεκαπέντε (15)|δεκαέξι (16)|δεκαεπτά (17)|δεκαοκτώ (18)|δεκαεννιά (19)|είκοσι(20)|είκοσι-ένα (21)|είκοσι -δύο (22)|είκοσι-τρεις (23)|είκοσι -τέσσερις (24)|είκοσι-πέντε  (25)|είκοσι -έξι (26)|είκοσι-επτά (27)|είκοσι -οκτώ (28)")

While 1
        Switch GUIGetMsg()
            Case -3
             Case $btn
                $Question = MsgBox(4,"ΑΥΞΗΜΕΝΑ","ΕΧΕΙΣ ΑΥΞΗΜΕΝΑ ΜΕΤΡΑ;") ;Here i ask if there is any dangerous person
                If $Question = 6 Then //;If there is i open a form and i will put some inputs so he can search the person/ For Example write in a last name and then autoit will scan Excel (what i am thinking) to see for any existing records and it will pass them into the gui. What do you think?
                   Else //;if not, perfect. It will go in and pass all the variables in my word and send them to a folder (Haven't completed it yet because i dont know if i am going to continue with that or with vba and access)
               Local $oWord = _Word_Create()
               Local $sXania = @ScriptDir & "\DIKI\XANIA.doc"
              Local $oDoc =  _Word_DocOpen($oWord, $sXania, Default, Default, True)
               _Word_DocFindReplace($oDoc, "ΗΜΕΡΑ", "777" )


EndFunc   ;=


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

  • Recently Browsing   0 members

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