FrancescoDiMuro

Create a database with AutoIt!

33 posts in this topic

#1 ·  Posted (edited)

Hi guys!
First of all, I want to apologize with @Melba23, @JLogan3o13, and @Jos ( I don't know why the tag sometimes works and sometimes doesn't ), for my bad attitude I have had with
them. I want to explain why I was so angry, but that's not an excuse to my bad attitude...
I have health problem, and lastly, I am ever more angry because I'm fighting with these problems for 5 years and I feel worse than 5 years ago, even If I had a lot of investigations about with a lot of Doctors, and there's no cure for my pathology. I don't want to touch anyone with my "story", but I wanted to explain why, sometimes, you can feel my anger in my words.
I promise I'll try to be as polite as my mom taught me, and to explain all I'd like to develop, posting all you need ( sample codes... ).

Now, let's talk about my project.
Let's start from 0! 
I'd like to implement a database with AutoIt, for the warehouse management.
First of all, I'd like to set some "goals" which I want to respect, developing my application:

  1. Efficiency: I'd like to develop an application that is fast as possible;
  2. Easy to make changes: I'd like to develop an application that is easy to modify, so, without too much complicated arguments;
  3. Noob-proof: As a noob as I am, my AutoIt knowledge starts from June 2016, so, I'm not a blade in this programming language. I studied C++, C, JavaScript, CSS, HTML and PHP, but, all of these programming language has a different approach comparing with AutoIt. I could be wrong in what I just estabilished! I want to tell you, again, that I'm here to listen to your suggestions, so, everything you say, it's something that I could learn, and I want to learn AutoIt, so, don't be scared to share your opinions, or your knowledge! I'm here to learn "How to AutoIt!" :ILA2:

Ok, so, after having set some goals I'd like to hit, I want to ask you some information:

  1. What's the best way to develop a database with AutoIt? With a .txt file? With an Excel workbook? 
    I was working on Excel workbook, but, I don't know, I could always be wrong in terms of efficiency and "easy to make changes";
  2. I have to create a GUI, in order to let the user do things ( I think it was quite obvious ), so, I have been always used GUI functions like GUICreate and so on; anything about _GDI_Plus or something else. Most, I used _GUI* functions. What's the best way to manage different GUIs? OnEvent Mode or Message Loop "mode"?

Now, I'd like to make a list of what I'd like my application would do:

  • Reading stocks: I manage mainly 2 manufacturers, so, If I will work with an Excel workbook, I'd prefer to divide first manufacturer with the second;
  • Add product: Simply, If a product does exist, the application prompt to the user an input box, with a sort of summary ( Product name, quantity ) of the product he's adding; ELSE, if the product does not exist, an "Add New Product" GUI should appers;
  • Withdraw product: As a warehouse, I need to add and to withdraw product... This "function" should performs the simply task of reserach the product based on his ID and, prompt an InputBox to the user, with a little summary of the product he's withdrawing and, the quantity of the product after the withdraw;
  • Search product: I'd like to develop a "product reserach", based on the ID of the product(s), or based on the Description of the product(s)... It'd be very nice! :wub:
  • Create DDT: Create a DDT with a pre-formatted Excel sheet. Just insert some information, and then all the products that have been withdrawn from the database ( maximum 14 per DDT );
I have already done some of work I described here, and you can find all files you need attached to this post. 
I don't want you to do this. Just, don't post your code that I have been looking for, but let me try, with your help, to get an appropriate and efficient solution to what I'm asking.
The last, but not the less important, the recognition I can give to you is publish your name ( or alias ) on the "developer section", more than a donation for everyone who has take part to this project.

Please, if you want to know further information ( I think I've been exhaustive enough ), write here or on a PM. 

Another time, a big thank you to this fantastic community and, a bigger one, to the developers of this amazing and powerful programming language.

Enjoy your night.

Francesco 

PS: I will post the code tomorrow ( the most updated code ), so you can see where I have been arrived and, nothing :)

Warehouse_Management.xlsx

Gestione_Magazzino_SYS.au3

Edited by FrancescoDiMuro
Attached code I'm working on...

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites



It sounds like a big project, but not necessarily that difficult.

The size of the warehouse is a big factor, if it is not super-massive, I would start by using sqlite database, forget flat databases.

You could easily expand to MSSQL or MYSQL  in future.

I would start with a gui containing just a text input for queries, a button, and a listview control for output. 


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Agree with J1. On that note, I suggest you start with a GUI shell like this:

#include <GUIConstantsEx.au3>

GUICreate("Test", 300, 300)

GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

GUIDelete()

Then look in the help file under GUIControlCreate* to look at the different controls you can create on the GUI (listviews, dropdown boxes, etc.). Try it out on your own, and get the GUI set up the way you want. You can then work on getting the underlying code.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Good morning everyone :) 
Thanks to @JohnOne and @JLogan3o13 for the answers!
 

Quote

The size of the warehouse is a big factor

I think it will always have less than 1000 products... Take care that I'd like to store even products that have a 0 Quantity, in order to maintain their features ( Description Cost, Notes... ).

Quote

Agree with J1. On that note, I suggest you start with a GUI shell like this:

I already have done something like this:
 

While 1
        $aMsg = GUIGetMsg(1)
        Switch $aMsg[1]
            Case $form_GestioneMagazzino
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        Exit
                    Case $button_ScegliDatabaseMagazzino
                        $sFileDatabaseMagazzino = ScegliFile()
                        GUICtrlSetData($input_DatabaseMagazzino, $sFileDatabaseMagazzino)
                    Case $button_VisualizzaTutteLeGiacenze
                        CreaListViewItems()
                    Case $button_PrelevaProdotto
                        GUIPrelevaProdotto()
                        $control_Button_Pressed = $input_CodiceProdottoPrelievo
                    Case $button_AggiungiProdotto
                        GUIAggiungiProdotto()
                        $control_Button_Pressed = $input_CodiceProdottoAggiunta
                    Case $button_DDT
                        GUICompilaDDT()
                    Case $button_RicercaProdotto
                        RicercaProdotto()
                EndSwitch
            Case $form_PopupRecord
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($form_PopupRecord)
                    Case $button_MostraInfo
                EndSwitch
            Case $form_PrelevaProdotto
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        ;GUICtrlSetData($input_CodiceProdottoPrelievo, "")
                        GUIDelete($form_PrelevaProdotto)
                    Case $button_MagazzinoRockwell
                        $sFlagMagazzino = "ROCKWELL"
                        GUICtrlSetData($input_MagazzinoSelezionato, "ROCKWELL")
                        GUICtrlSetState($input_CodiceProdottoPrelievo, $GUI_FOCUS)
                    Case $button_MagazzinoSiemens
                        $sFlagMagazzino = "SIEMENS"
                        GUICtrlSetData($input_MagazzinoSelezionato, "SIEMENS")
                        GUICtrlSetState($input_CodiceProdottoPrelievo, $GUI_FOCUS)
                EndSwitch
            Case $form_AggiungiProdotto
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        ;GUICtrlSetData($input_CodiceProdottoAggiunta, "")
                        GUIDelete($form_AggiungiProdotto)
                    Case $button_MagazzinoRockwell
                        $sFlagMagazzino = "ROCKWELL"
                        GUICtrlSetData($input_MagazzinoSelezionato, "ROCKWELL")
                        GUICtrlSetState($input_CodiceProdottoAggiunta, $GUI_FOCUS)
                    Case $button_MagazzinoSiemens
                        $sFlagMagazzino = "SIEMENS"
                        GUICtrlSetData($input_MagazzinoSelezionato, "SIEMENS")
                        GUICtrlSetState($input_CodiceProdottoAggiunta, $GUI_FOCUS)
                EndSwitch
            Case $form_AggiungiNuovoProdotto
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($form_AggiungiNuovoProdotto)
                    Case $button_AggiungiProdotto
                        If GUICtrlRead($input_Codice) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire un 'Codice Prodotto' per continuare!", 3)
                            GUICtrlSetState($input_Codice, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUICtrlRead($input_Marca) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire una 'Marca Prodotto' per continuare!", 3)
                            GUICtrlSetState($input_Marca, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUICtrlRead($input_Quantita) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire una 'Quantità Prodotto' per continuare!", 3)
                            GUICtrlSetState($input_Quantita, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUICtrlRead($edit_Descrizione) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire una 'Descrizione Prodotto' per continuare!", 3)
                            GUICtrlSetState($edit_Descrizione, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If $sFlagMagazzino = "ROCKWELL" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire un 'Codice a Barre Prodotto' per continuare!", 3)
                            GUICtrlSetState($input_CodiceABarre, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        AggiungiNuovoProdotto()
                    Case $button_Annulla
                        GUIDelete($form_AggiungiNuovoProdotto)
                EndSwitch
            Case $form_CompilaDDT
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($form_CompilaDDT)
                    Case $button_CompilaDDT
                        If GUIctrlRead($input_NumeroDDT) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire un 'Numero DDT' per continuare!", 3)
                            GUICtrlSetState($input_NumeroDDT, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUIctrlRead($input_DestinatoA_1) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire un 'Destinatario' per continuare!", 3)
                            GUICtrlSetState($input_DestinatoA_1, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUIctrlRead($input_Via) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire una 'Via' per continuare!", 3)
                            GUICtrlSetState($input_Via, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUIctrlRead($input_Citta) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire una 'Città' per continuare!", 3)
                            GUICtrlSetState($input_Citta, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUIctrlRead($input_Stato) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire uno 'Stato' per continuare!", 3)
                            GUICtrlSetState($input_Stato, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUIctrlRead($input_Causale1) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire almeno una 'Causale' per continuare!", 3)
                            GUICtrlSetState($input_Causale1, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                        If GUIctrlRead($input_NumeroColli) = "" Then
                            MsgBox($MB_ICONERROR, "Errore!", "Inserire il 'Numero Colli' per continuare!", 3)
                            GUICtrlSetState($input_NumeroColli, $GUI_FOCUS)
                            ContinueLoop
                        EndIf
                CompilaDDT()
            EndSwitch
        EndSwitch
        If $iLVFlag <> -1 Then
            CreaPopupRecord()
            $iLVFlag = -1
        EndIf
WEnd

This is for managing different GUI's... It is correct?

By the way, I have attached to the #1 post the entire code I'm using.
If you want to take a look and tell me if I can ( surely ) improve it, please do it :)
Thanks!


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@JohnOne
SQLite seems to be very nice to use, and really simple too!
Can you tell me something more about it? I'd be very happy, and, I'm already excited! :D
Thanks :D 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

I'm trying to register sqlite3.dll or sqlite3_x64.dll with regsvr32.exe sqlite3.dll, but I always encounter this error:
Cattura.PNG
 

What can I do? I've already tried to run cmd as admin, but nothing changed...
Thanks :) 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

Means:

"Module "sqlite3_x64.dll" It was loaded, but the entry point DLLRegisterServer was not found. Make sure "sqlite3_x64.dll" is a valid OCX or DLL file then try again.

IIRC there is a thread on the forum or some docu in the wiki how to install SQLite.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hey @water.
I made a search, and seems that everyone had post the same solution, but not the most appropriate for my case... I really don't know how to proceed...
Tried with:

  • REGSVR32 sqlite3.dll : same error as above;
  • This script:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; SQLite.dll version must match

#include <MsgBoxConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $sSQliteDll = _SQLite_Startup(@ScriptDir & "\sqlite3.dll")

If @error Then
    MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
            "Not FOUND in @SystemDir, @WindowsDir, @ScriptDir, @WorkingDir, @LocalAppDataDir\AutoIt v3\SQLite")
    Exit -1
EndIf

MsgBox($MB_SYSTEMMODAL, "SQLite3.dll Loaded", $sSQliteDll & " (" & _SQLite_LibVersion() & ")")
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Shutdown()

... and I got the first error ( "Not found"... )

EDIT:

Got a solution!

Local $sSQliteDll = _SQLite_Startup("sqlite3_x64.dll", False, 1)

In this mode, the function _SQLite_Startup doesn't search the .dll in the folders "@ScriptDir", "@WindowsDir" and so on, but catch the defined one ( .dll ).
Now I'm working on the creation of the DB... Any suggestion?

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I am still waiting for your responses guys.
I know you are not here JUST for me, but a bit of consideration would be appreciated.
I don't suit very well the "SQLite", just because seems to be a lot intricate, and I'd like to implement something simple.

Could I try with a .txt file, with fields formatted by ";" or something like that? In terms of efficiency, is that a good alternative? 

And please, help me on the "My_WM_COMMAND", in the post #1 ( attached ).

I'm trying now with this, but I noticed that ID of two diffrent control is the same... :/ 

Take a look, please:

 

Func My_WM_COMMAND($hwnd, $msg, $wparam, $lparam)
    If _WinAPI_HiWord($wparam) = $EN_UPDATE And _WinAPI_LoWord($wparam) = $control_Button_Pressed And GUICtrlRead($control_Button_Pressed) <> "" And Sleep(150) Then
                Switch($control_Button_Pressed)
                    Case $input_CodiceProdottoPrelievo
                        ConsoleWrite("Caso - Prelievo: " & @CRLF)
                        ConsoleWrite("CBP ( Prelievo ): " & $control_Button_Pressed & @CRLF)
                        ;PrelevaProdotto()
                        GUICtrlSetState($input_CodiceProdottoPrelievo, $GUI_FOCUS)
                    Case $input_CodiceProdottoAggiunta
                        ConsoleWrite("Caso - Aggiunta: " & @CRLF)
                        ConsoleWrite("CBP ( Aggiunta ): " & $control_Button_Pressed & @CRLF)
                        ;AggiungiProdotto()
                        GUICtrlSetState($input_CodiceProdottoAggiunta, $GUI_FOCUS)
                EndSwitch
    EndIf
    $control_Button_Pressed = 9999
    ConsoleWrite("Controllo dopo: " & $control_Button_Pressed & @CRLF)
    Return $GUI_RUNDEFMSG
EndFunc ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> My_WM_COMMAND_PrelevaProdotto($hwnd, $msg, $wparam, $lparam)



Thanks :) 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#10 ·  Posted

59 minutes ago, FrancescoDiMuro said:

I am still waiting for your responses guys.
I know you are not here JUST for me, but a bit of consideration would be appreciated.

These are the kinds of responses that make people less willing to help you. Please follow the forum etiquette and wait 24 hours before bumping your post. We understand that this is the most important thing in the world to you right now, but you need to show some patience. And you can use that time while you're waiting for a response to search the forum for people who have had similar issues, try to work some of these things out for yourself rather than simply throwing your hands up and asking for someone to work it out for you.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#11 ·  Posted

Just now, JLogan3o13 said:

These are the kinds of responses that make people less willing to help you.

I'm asking for help, I'm not pretending anything.
 

1 minute ago, JLogan3o13 said:

We understand that this is the most important thing in the world to you right now

I have to do this, it's part of my job.
 

1 minute ago, JLogan3o13 said:

search the forum for people who have had similar issues

I did. No one seems have had similiar issues...
 

2 minutes ago, JLogan3o13 said:

try to work some of these things out for yourself rather than simply throwing your hands up and asking for someone to work it out for you.

In the #1 post, I have clearly wrote this:
 

Quote

I don't want you to do this. Just, don't post your code that I have been looking for, but let me try, with your help, to get an appropriate and efficient solution to what I'm asking.

Have a good day @JLogan3o13 :) 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#12 ·  Posted

Not going to argue with you, as we did in the other thread. Please wait 24 hours before bumping your post if you're not getting responses, end of discussion.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#13 ·  Posted

I will! At 14:41 of 19/01/2017, if no one has posted anything, I can "bump" my post!
Yeah, Sir.
:thumbsup::yes::bye:


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#14 ·  Posted

So you have been working with the SQLlite recommendation for a couple of hours and gave up? Because your next few recommendations are also going to be sqllite, followed closely by asking if you were looking for the slowest possible language in which to wire this together.  I'd want to know what is the max number of rows, and probably suggest flat files that are read into memory, and once that blows it's caps then move towards a proper db solution (and probably not in autoit).


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#15 ·  Posted

Hi @iamtheky.
Nope, I don't gave up! :)
I just don't feel this way to be THE WAY I would like to implement :)
By the way, I think will be no more than 1000 rows :)
I'm here, listening to you :) 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Sure, but do recognize it is going to be difficult for people to step back and help you build a sub-optimal solution.

Quote
Quote

Could I try with a .txt file, with fields formatted by ";" or something like that? In terms of efficiency, is that a good alternative? 

 

While you second guessed your own suggestion, I would start here. It gives you lots of flexibility, just make sure you are extensible from the beginning with both a column delimiter and a row delimiter, otherwise you have to start over.

When you start getting close to 50,000 rows you may want to revisit the database.

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#17 ·  Posted

SQL and database is the way to go. You can try to create it with Access, or Oracle or other free database and then use SQL or MySQL or other depending on what database you chose. For not more than 1000 rows i would choose Excel.

Share this post


Link to post
Share on other sites

#18 ·  Posted

@iamtheky
 

1 minute ago, iamtheky said:

just make sure you are extensible from the beginning with both a column delimiter and a row delimiter

Yeah, for sure! 
Since I am managing two different manufacturers, I will have 2 row delimiters for each manufacturer, something like this:
[ End of Manufacturer 1 ], [ End of Manufacturer 2 ], which I will manage with String* functions...
In terms of row, I'd use a delimiter like "|" or something that it's not used so often.

By the way, thank you for your suggestion. You're an example to follow :)
Stay tuned if you want, and if you have some great idas! "iamthekey" added to the "contributers" :D Thanks!


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#19 ·  Posted

@Juvigy
Thanks for your reply!
I thought at first Excel, because it's a good "place" to start and, AutoIt has a UDF dedicated for Excel, and because I haven't ever had an approach with Access Database or Oracle... Just MySQL...
Now I'm encountering this error with a function that should returns an array...
I'm checking...
That's the error:

Subscript used on non-accessible variable.

If you have any other ideas, I'm here, listening to you too :) 
Thanks!


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#20 ·  Posted

look at Czardas posts about 'replacement characters' if you run into issues finding a column delimiter that's not in the text. Also consider using @LF or @CR for rows so your text file is human readable.

And my advice is sketchy at best, use at your own peril.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
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

  • Similar Content

    • ChrisL
      By ChrisL
      #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> Global $g_hTreeView Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo Example() Func Example() Local $hGUI, $hItem Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) $hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300) $g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") _GUICtrlTreeView_BeginUpdate($g_hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($g_hTreeView) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam ;ConsoleWrite($GUI_RUNDEFMSG & @CRLF) ;Switch $wParam ; Case $hTreeView Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True ;EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_CONTEXTMENU Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $e_idOpen _DebugPrint("WM_COMMAND " & $wParam & " Open") Case $e_idSave _DebugPrint("WM_COMMAND " & $wParam & " Save") Case $e_idInfo _DebugPrint("WM_COMMAND " & $wParam & " Info") EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $g_hTreeView If Not IsHWnd($g_hTreeView) Then $hWndTreeview = GUICtrlGetHandle($g_hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint In the example code I have a treeview and a context/popup menu, I can't use a conventional context menu because I need to use the treeview UDF functions.
      The WM_COMMAND never fires from the context/popup menu selection while there is a treeview using  _GuiCtrlTreeview_Create
      If you comment out _GuiCtrlTreeview_Create line you will then see the right click selection works as expected and the debug is written to the console on selection.
      Autoit Ver 3.3.14.2
      Any ideas why this combination won't work together?
      Thanks
       
    • r0ash
      By r0ash
      Hey guys, MattDiesel over Stackoverflow mentioned this beautiful piece of code 
      #include <WindowsConstants.au3> #include <WinAPI.au3> Local $IDM_FONT = 33 Local $hWindow = WinGetHandle("Untitled - Notepad") _WinAPI_PostMessage($hWindow, $WM_COMMAND, $IDM_FONT, 0) Local $hFontWin = WinWait("Font") $select = ControlCommand($hFontWin, "", "ComboBox1", "GetCurrentSelection", "") WinClose($hFontWin) MsgBox(0,"", $select) I realized that _WinAPI_PostMessage can trigger menu click event, even if Notepad is minimized.
      How do we know what is the decimal value of *any menu item or sub-menu item*? How we know "Format > Font" menu-item is 33 as wParam to _WinAPI_PostMessage()? Have a look at snapshot.
      Regards.

    • water
      By water
      My computer has been upgraded from Office 2010 to Office 2016.
      Are there any features of Office 2013 or Office 2016 which you now want to see in the Excel, Word or Outlook UDF?
    • Faedien
      By Faedien
      Hello all, 
      I've lurked around here for a while and learned a ton from everyone, but I can't see this issue anywhere.  I've been running macros through Autoit for a while in a number of programs, but I'm having some issues with this one.
      Func RunMacro() Local $oExcel = _Excel_Open(False, False, False, False) ;Excel Program Local $oWorkbook = _Excel_BookOpen($oExcel, "C:/Equity Helper/Scripts/calendarmacros.xlsm", Default, Default, True) $oExcel.Run("calendarmacros.xlsm!Calendar") EndFunc When I run this bit of code everything works fine as long as the macro gets to finish.  But the actual VBA calls two "Application.UserInput" fields, and if I cancel out of either the macro closes, and then AutoIt throws an error at--
      $oExcel.(<---error throws here)Run("calendarmacros.xlsm!Calendar") I don't want to use autoit for the user inputs if possible, it's just easier to get the data I need for the inputs from within the VBA environment, but I'm afraid that's what's causing the problem.
    • Basement
      By Basement
      Hi,
       
      im writing from an array to an excel sheet and want to use line breaks.
       
      The following piece of code does not do this job (instead of the line break the "[...]chr(10)[...]" is displayed in the cell:
       
      #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> ; Create application object and create a new workbook Local $oAppl = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookNew($oAppl) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Exit EndIf ; ***************************************************************************** ; Write a 1D array to the active sheet in the active workbook ; ***************************************************************************** Local $aArray1D[3] = ['"Zeile 1 " & vbLf & " Zeile 2"', 'B', 'CC'] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray1D, "A3") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.") What am i doing wrong?

      Any help is appreciated.
       
      Best regards
       
      Daniel