Jump to content

DB in autoit


Recommended Posts

Hi, I wanted to create an application in autoit which would keep a track of items procured and returned, and show outstanding items which are yet to be returned. For example:

A particular cd is procured from my dept. The details of the person procuring the item is collected by using a form as seen in the following script. Now, I need to store this data somewhere. Later when that person comes to return the material, I want to search my database with his name and want to clear his name from the database. Also at any given time, I want to see the list of people who have yet not returned their items.

This is how much I have done till now (which is not much).

#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Media Manager", 404, 269, 193, 115)
$Group1 = GUICtrlCreateGroup("Actions", 0, 0, 401, 265)
$procure = GUICtrlCreateButton("Procuring Media", 80, 80, 249, 33, 0)
$Return = GUICtrlCreateButton("Returning Media", 80, 136, 249, 33, 0)
$Check = GUICtrlCreateButton("Check Outstanding", 80, 192, 249, 33, 0)
$Label1 = GUICtrlCreateLabel("Select from following actions: ", 32, 32, 144, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $GUI_EVENT_CLOSE
Exit
Case $Procure
    procuring()
    Exit
Case $return
    returning()
    Exit
Case $check
    checking()
    Exit
EndSwitch
WEnd

Func procuring()

#include <GUIConstantsEx.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Media Manager", 571, 447, 193, 115)
$Group2 = GUICtrlCreateGroup("Procurement Form", 0, 0, 569, 441)
$Label2 = GUICtrlCreateLabel("Name: ", 24, 32, 38, 17)
$Name = GUICtrlCreateInput("", 72, 32, 209, 21)
$Label3 = GUICtrlCreateLabel("EID No.: ", 24, 72, 48, 17)
$EID =GUICtrlCreateInput("", 72, 72, 97, 21)
$Label4 = GUICtrlCreateLabel("Please Enter the list of Items procured. (Include the Release Version and type of media.):", 24, 120, 420, 17)
$item1 = GUICtrlCreateInput("", 40, 176, 321, 21)
$Label5 = GUICtrlCreateLabel("1.", 24, 176, 13, 17)
$Label6 = GUICtrlCreateLabel("2.", 24, 224, 13, 17)
$item2 = GUICtrlCreateInput("", 40, 224, 321, 21)
$Label7 = GUICtrlCreateLabel("Date: ", 312, 72, 33, 17)
$date = GUICtrlCreateInput("", 376, 72, 145, 21)
$Label8 = GUICtrlCreateLabel("BU /Team:", 312, 32, 57, 17)
$BU = GUICtrlCreateInput("", 376, 32, 177, 21)
$Label9 = GUICtrlCreateLabel("3.", 24, 272, 13, 17)
$item3 = GUICtrlCreateInput("", 40, 272, 321, 21)
$Label10 = GUICtrlCreateLabel("Example: R310.3 Application Media", 40, 136, 172, 17)
$item4 = GUICtrlCreateInput("", 40, 320, 321, 21)
$Label11 = GUICtrlCreateLabel("4.", 24, 320, 13, 17)
$Label12 = GUICtrlCreateLabel("5.", 24, 368, 13, 17)
$Enter1 = GUICtrlCreateButton("Enter", 216, 408, 129, 25, 0)
$item5 = GUICtrlCreateInput("", 40, 368, 321, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg2 = GUIGetMsg()
Switch $nMsg2
Case $GUI_EVENT_CLOSE
Return
ExitLoop

Case $Enter1
    Enter data()
EndSwitch
WEnd
EndFunc

I am not exactly sure where and how to save the data, and how to recall it and then clear it when item is returned. Also how to search the database to find the name of a particular person returning the items. Also how to display this database of people who yet haven't returned the items.

Any help is appreciated. Thanks a lot.

Regards,

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

You can use _SQLite functions or you can make your own database file.

Hi I have no idea whatsoever how to use these SQLite functions.. Please could you help me by illustrating some simple examples?
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

A problem which I realized in the SQLite method is thatonce I create a table of data and make an entry in it and if i stop the script and restart it, that data has gone and table doesn't exist. I intend to use this to make entries as and when I want. I won't be keeping the script running forever.

If anybody has any better solution or if there's another way in which I could use the SQLite functions, it would be a great help!!

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

When you open/create the sql database you need to give it a filename otherwise you end up with a in memory database instead of a one that can be read again.

_SQLite_Open ( [ $sDatabase_Filename = ":memory:" ] )

$sDatabase_Filename [optional] Database filename, by default will open an in memory database.

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
Link to comment
Share on other sites

Guys, its cool..

I found another way and finished 90% of the script. I used an excel sheet to make entries. And it's working great!!

Will update u when the entire script is finished and ready!!

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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...