rony2006

CTRL+C on listview

8 posts in this topic

Hello I have the following script:

;v0.2 15.09.2017 Adaugat functia de confirmare comanda selectata din lista
;v0.2 15.09.2017 Adaugat CTRL + C pt clipboard comanda selectata din lista

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include "EzMySql.au3"
#Include <WinAPI.au3>
#include <CommMG.au3>                                                                                                               ;~ for arduino
#include "CommInterface.au3"    
#include <Clipboard.au3>

HotKeySet("^c", "copiere")
Opt("GUIOnEventMode", 1) 



$Main = GUICreate("Comisionare depozit v0.2",1051,634,-1,-1,-1,-1)
GUISetBkColor(0x9CC2ED,$Main)
GUICtrlCreatePic(@ScriptDir & "\logo_ifm.JPG",0,0,1051,122,-1,-1)
$lista = GUICtrlCreatelistview("ID|Comanda|Status|Data Limita|Data Inchidere|Operator Productie|",10,140,1028,402,$LVS_NOLABELWRAP,BitOr($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES));369
GUICtrlSetFont(-1,16,700,0,"Calibri")
GUICtrlSetBkColor(-1,"0xDDDDDD")
$confirmareComisionare = GUICtrlCreateButton("Confirmare Comisionare",908,556,132,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
GUICtrlSetFont(-1,16,700,0,"Calibri")
;$copiere = GUICtrlCreateButton("Copiere",10,556,161,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
;GUICtrlSetFont(-1,16,700,0,"Calibri")
Global $comenziDeschise = GUICtrlCreateButton("Comenzi Deschise",523,556,117,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
GUICtrlSetFont(-1,16,700,0,"Calibri")
;$comenziInchise = GUICtrlCreateButton("Comenzi Inchise",391,556,117,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
;GUICtrlSetFont(-1,16,700,0,"Calibri")
;$toateComenziile = GUICtrlCreateButton("Toate Comenziile",257,556,117,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
;GUICtrlSetFont(-1,16,700,0,"Calibri")
$input = GUICtrlCreateInput("",698,570,173,43,$ES_CENTER,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,22,700,0,"Calibri")
$status = GUICtrlCreateLabel("",280,67,750,50,BitOr($SS_LEFT,$SS_CENTERIMAGE),-1)
GUICtrlSetFont(-1,48,700,0,"Calibri")
GUICtrlSetColor(-1,"0xFF0000")
GUICtrlSetBkColor(-1,"-2")


 Local $aAccelKeys[2][2] = [["^c", $idYes], ["^n", $idNo]]
    GUISetAccelerators($aAccelKeys)




GUISetState(@SW_SHOW,$Main)

_GUICtrlListView_SetColumnWidth($lista, 0, 80)
_GUICtrlListView_SetColumnWidth($lista, 1, 130)
_GUICtrlListView_SetColumnWidth($lista, 2, 130)
_GUICtrlListView_SetColumnWidth($lista, 3, 220)
_GUICtrlListView_SetColumnWidth($lista, 4, 220)
_GUICtrlListView_SetColumnWidth($lista, 5, 150)
;_GUICtrlListView_SetColumnWidth($lista, 6, 200)



GUICtrlSetOnEvent($confirmareComisionare, "Confirmare_Comisionare")
;GUICtrlSetOnEvent($copiere, "Copiere")
GUICtrlSetOnEvent($comenziDeschise, "Comenzi_Deschise")
;GUICtrlSetOnEvent($comenziInchise, "Comenzi_Inchise")
;GUICtrlSetOnEvent($toateComenziile, "Toate_Comenziile")
_GUICtrlListView_SetItemCount($lista, 5000)



;3.2) initalisation of the COM port
;============================================================================================================================================================================================================================
#cs
    Local Const $iPort = 4                                                                                                          ;~ defining the port Number
    Local Const $iBaud = 9600                                                                                                       ;~ defining the baudrate
    Local Const $iParity = 0                                                                                                        ;~ defining the parity
    Local Const $iByteSize = 8                                                                                                      ;~ size of the sended information
    Local Const $iStopBits = 1                                                                                                      ;~ defining the amount of stop bits
    Local Const $sCommand = "Command" & @CRLF                                                                                       ;~ tbd
    global $t = "================================="                                                                                 ;~ tbd

    Local $hFile = _CommAPI_OpenCOMPort($iPort, $iBaud, $iParity, $iByteSize, $iStopBits)                                           ;~ Open com port of arduino
    If @error Then Return SetError(@error, @ScriptLineNumber)                                                                       ;~ Errormessage in case of error

    _CommAPI_ClearCommError($hFile)                                                                                                 ;~ ??? something with windows API-Application Programming Interface
    If @error Then Return SetError(@error, @ScriptLineNumber)                                                                       ;~ Errormessage in case of error

    _CommAPI_PurgeComm($hFile)                                                                                                      ;~ ??? something with windows API-Application Programming Interface
    If @error Then Return SetError(@error, @ScriptLineNumber)                                                                       ;~ Errormessage in case of error


#ce














Func Database_start()

If Not _EzMySql_Startup() Then
    MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

$Pass = "QCaRTrF4VzaRUcWQ"

If Not _EzMySql_Open("defdsf", "rodada", $Pass, "sibiu", "3308") Then
    MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf
EndFunc

Func date()
Database_start()
     



Local $sMySqlStatement                                                                                                                                                                                                                                      ;~ run the UDF _DbStart
$aStartTimeLastOrder            = "SELECT ADDTIME(NOW(),'01:00:00')  FROM DUAL;"                                    
   Global $aStartTimeLastOrder1     =_EzMySql_GetTable2d($aStartTimeLastOrder)                                                      
         $error = @error                                                                                                            
         If Not IsArray($aStartTimeLastOrder1) Then MsgBox(0, $sMySqlStatement & " error", $error)  EndIf                           

Global $sOut_Date = $aStartTimeLastOrder1[1][0]
;Msgbox (0, "Date", $aStartTimeLastOrder1[1][0])



                _EzMySql_Close()
_EzMySql_ShutDown()
Endfunc


GUICtrlSetState(-1, $GUI_FOCUS)

GUISetState()
_WinAPI_SetFocus(ControlGetHandle("Comisionare depozit v0.2", "", $input))

Comenzi_Deschise()
Verificare_Status()



While 1
    sleep (30000)
    Verificare_Status()
    Comenzi_Deschise()
WEnd


Func Confirmare_Comisionare()
beep (750, 750)

date()
            $t_data1 =  "'" & $sOut_Date & "'"


Database_start()

 
 if  GUICtrlRead($input) > 22 Then
 $comanda_com = "'" & GUICtrlRead($input) & "'"
 Else
 Global $ab = _GUICtrlListView_GetItemTextArray($lista,-1)
Global $comanda_com = $ab[2]
 endif
 


$iesire1st = "UPDATE depozit SET ifm_status ='Comisionat'  WHERE ifm_comanda= "& $comanda_com  &""
 If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf

$iesire1st = "UPDATE depozit SET  ifm_data_comisionare= "& $t_data1 &" WHERE ifm_comanda= "& $comanda_com  &""
 If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf
            
            
            
            

                _EzMySql_Close()
_EzMySql_ShutDown()



Comenzi_Deschise()

Verificare_Status()
GUICtrlSetData($input, "")
_WinAPI_SetFocus(ControlGetHandle("Main", "", $input))
beep (2000, 800)
Endfunc

Func Printare()
beep (1000, 1000)

Endfunc

Func Comenzi_Deschise()

_GUICtrlListView_DeleteAllItems($lista)

Database_start()

$interogare = "SELECT * FROM `depozit` WHERE `ifm_status` = 'deschis' ORDER BY id ASC"


        Global $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then sleep (50)

        ;_ArrayDisplay ($aOk, "fd")
        _GUICtrlListView_AddArray($lista, $aOk)
        sleep (40)
        
        
        
        _GUICtrlListView_DeleteItem($lista, 0)
        

                _EzMySql_Close()
_EzMySql_ShutDown()


Verificare_Status()
_WinAPI_SetFocus(ControlGetHandle("Comisionare depozit v0.2", "", $input))
Endfunc

Func Comenzi_Inchise()

_GUICtrlListView_DeleteAllItems($lista)

Database_start()

$interogare = "SELECT * FROM `depozit` WHERE `ifm_status` = 'Comisionat' ORDER BY id ASC"


        Global $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then sleep (50)

        ;_ArrayDisplay ($aOk, "fd")
        _GUICtrlListView_AddArray($lista, $aOk)
        sleep (40)
        _GUICtrlListView_DeleteItem($lista, 0)
        

                _EzMySql_Close()
_EzMySql_ShutDown()










Endfunc

Func Toate_Comenziile()
_GUICtrlListView_DeleteAllItems($lista)

Database_start()

$interogare = "SELECT * FROM `depozit` WHERE 1 ORDER BY id ASC"


        Global $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then sleep (50)

        ;_ArrayDisplay ($aOk, "fd")
        _GUICtrlListView_AddArray($lista, $aOk)
        sleep (40)
        _GUICtrlListView_DeleteItem($lista, 0)
        

                _EzMySql_Close()
_EzMySql_ShutDown()


Verificare_Status()
Endfunc


Func Verificare_Status()
Database_start()
$interogare = "SELECT * FROM `depozit` WHERE `ifm_status` = 'deschis' ORDER BY id ASC"


        Global $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then sleep (50)

        $iRows = UBound($aOk, $UBOUND_ROWS)

        if $iRows > 1 Then
        GUICtrlSetData($status, "Comenzi Deschise: " & $iRows - 1)
        GUICtrlSetColor(-1,"0xFF0000")
        Else
        GUICtrlSetData($status, "Nu exista comenzi deschise")
        GUICtrlSetColor(-1,"0x00FF00")
        Endif
        
        
        if $iRows -1 > 3 Then
        ;_CommAPI_TransmitString($hFile, "1")
        ;If @error Then Return SetError(@error, @ScriptLineNumber)
        Endif
        
                if $iRows -1 <= 2 Then
        ;_CommAPI_TransmitString($hFile, "2")
        ;If @error Then Return SetError(@error, @ScriptLineNumber)
        Endif
        
        
        
        
        
                    _EzMySql_Close()
_EzMySql_ShutDown() 

Endfunc





Func copiere()

Global $ab = _GUICtrlListView_GetItemTextArray($lista,-1)
Global $nrcom = $ab[2]
;msgbox(0, "", $nrcom)
ClipPut ($nrcom)


Endfunc

 

The user wants to be able to select a row in the listview and to use CTRL C to copy a item from it.

I tried to do this with hotkeyset and then:

Func copiere()

Global $ab = _GUICtrlListView_GetItemTextArray($lista,-1)
Global $nrcom = $ab[2]
;msgbox(0, "", $nrcom)
ClipPut ($nrcom)


Endfunc

but the problem is that CTRL -C is no longer working in other programs.

 

I saw that I can use guisetaccelerators but in my script I think I cannot use a switch loop for it.

Is there any option to accomplish this? Maybe to make some how the item from listview selected and then to copy data with CTRL + C like we do in a normal input box?

I tried to put a GUI button but the user wants to use CTRL + C.

 

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi @rony2006:)

27 minutes ago, rony2006 said:

but the problem is that CTRL -C is no longer working in other programs.

Why HotKeySet() doesn't work for you?

Show us how did you use HotKeySet() :)

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

As long as the program is running, it will capture the CTRL-C for itself, so naturally it won't work anywhere else.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hello,

HotKeySet()  is working for me but i can not use CTRL C in other applications opened in the same time.

How can I solve this please?

Share this post


Link to post
Share on other sites
1 hour ago, rony2006 said:

How can I solve this please?

You can't.

Also, you're using CTRL-C twice in your script, one of them has to go, either the HotKeySet, or the Accelerator you have set up. And, your Accelerator is written completely wrong.

You could use a Dummy control and an Accelerator instead of a hotkey to make it so that your hotkey is only active when your GUI is active if that's what you're attempting to do.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Can you give me an example please?

I didnt found clear infos abou acelerators and dummy control.

Share this post


Link to post
Share on other sites

Try it this way and let us know if it works.

;v0.2 15.09.2017 Adaugat functia de confirmare comanda selectata din lista
;v0.2 15.09.2017 Adaugat CTRL + C pt clipboard comanda selectata din lista

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include "EzMySql.au3"
#include <WinAPI.au3>
#include <CommMG.au3>;~ for arduino
#include "CommInterface.au3"
#include <Clipboard.au3>

Opt("GUIOnEventMode", 1)

$Main = GUICreate("Comisionare depozit v0.2", 1051, 634, -1, -1, -1, -1)
GUISetBkColor(0x9CC2ED, $Main)
GUICtrlCreatePic(@ScriptDir & "\logo_ifm.JPG", 0, 0, 1051, 122, -1, -1)
$lista = GUICtrlCreateListView("ID|Comanda|Status|Data Limita|Data Inchidere|Operator Productie|", 10, 140, 1028, 402, $LVS_NOLABELWRAP, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES));369
GUICtrlSetFont(-1, 16, 700, 0, "Calibri")
GUICtrlSetBkColor(-1, "0xDDDDDD")
$confirmareComisionare = GUICtrlCreateButton("Confirmare Comisionare", 908, 556, 132, 67, BitOR($BS_MULTILINE, $WS_BORDER), -1)
GUICtrlSetFont(-1, 16, 700, 0, "Calibri")
;$copiere = GUICtrlCreateButton("Copiere",10,556,161,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
;GUICtrlSetFont(-1,16,700,0,"Calibri")
Global $comenziDeschise = GUICtrlCreateButton("Comenzi Deschise", 523, 556, 117, 67, BitOR($BS_MULTILINE, $WS_BORDER), -1)
GUICtrlSetFont(-1, 16, 700, 0, "Calibri")
;$comenziInchise = GUICtrlCreateButton("Comenzi Inchise",391,556,117,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
;GUICtrlSetFont(-1,16,700,0,"Calibri")
;$toateComenziile = GUICtrlCreateButton("Toate Comenziile",257,556,117,67,BitOr($BS_MULTILINE,$WS_BORDER),-1)
;GUICtrlSetFont(-1,16,700,0,"Calibri")
$input = GUICtrlCreateInput("", 698, 570, 173, 43, $ES_CENTER, $WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1, 22, 700, 0, "Calibri")
$status = GUICtrlCreateLabel("", 280, 67, 750, 50, BitOR($SS_LEFT, $SS_CENTERIMAGE), -1)
GUICtrlSetFont(-1, 48, 700, 0, "Calibri")
GUICtrlSetColor(-1, "0xFF0000")
GUICtrlSetBkColor(-1, "-2")
$Dummy = GUICtrlCreateDummy ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetOnEvent($Dummy, "copiere") ; <<<<<<<<<<<<<<<<<<<<<
Local $aAccelKeys[1][2] = [["^c", $Dummy]] ; <<<<<<<<<<<<<<<<<<<<<<<
GUISetAccelerators($aAccelKeys)

GUISetState(@SW_SHOW, $Main)

_GUICtrlListView_SetColumnWidth($lista, 0, 80)
_GUICtrlListView_SetColumnWidth($lista, 1, 130)
_GUICtrlListView_SetColumnWidth($lista, 2, 130)
_GUICtrlListView_SetColumnWidth($lista, 3, 220)
_GUICtrlListView_SetColumnWidth($lista, 4, 220)
_GUICtrlListView_SetColumnWidth($lista, 5, 150)
;_GUICtrlListView_SetColumnWidth($lista, 6, 200)

GUICtrlSetOnEvent($confirmareComisionare, "Confirmare_Comisionare")
;GUICtrlSetOnEvent($copiere, "Copiere")
GUICtrlSetOnEvent($comenziDeschise, "Comenzi_Deschise")
;GUICtrlSetOnEvent($comenziInchise, "Comenzi_Inchise")
;GUICtrlSetOnEvent($toateComenziile, "Toate_Comenziile")
_GUICtrlListView_SetItemCount($lista, 5000)

;3.2) initalisation of the COM port
;============================================================================================================================================================================================================================
#cs
    Local Const $iPort = 4                                                                                                          ;~ defining the port Number
    Local Const $iBaud = 9600                                                                                                       ;~ defining the baudrate
    Local Const $iParity = 0                                                                                                        ;~ defining the parity
    Local Const $iByteSize = 8                                                                                                      ;~ size of the sended information
    Local Const $iStopBits = 1                                                                                                      ;~ defining the amount of stop bits
    Local Const $sCommand = "Command" & @CRLF                                                                                       ;~ tbd
    global $t = "================================="                                                                                 ;~ tbd

    Local $hFile = _CommAPI_OpenCOMPort($iPort, $iBaud, $iParity, $iByteSize, $iStopBits)                                           ;~ Open com port of arduino
    If @error Then Return SetError(@error, @ScriptLineNumber)                                                                       ;~ Errormessage in case of error

    _CommAPI_ClearCommError($hFile)                                                                                                 ;~ ??? something with windows API-Application Programming Interface
    If @error Then Return SetError(@error, @ScriptLineNumber)                                                                       ;~ Errormessage in case of error

    _CommAPI_PurgeComm($hFile)                                                                                                      ;~ ??? something with windows API-Application Programming Interface
    If @error Then Return SetError(@error, @ScriptLineNumber)                                                                       ;~ Errormessage in case of error


#ce

Func Database_start()

    If Not _EzMySql_Startup() Then
        MsgBox(0, "Error Starting MySql", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
        Exit
    EndIf

    $Pass = "QCaRTrF4VzaRUcWQ"

    If Not _EzMySql_Open("defdsf", "rodada", $Pass, "sibiu", "3308") Then
        MsgBox(0, "Error opening Database", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
        Exit
    EndIf
EndFunc   ;==>Database_start

Func date()
    Database_start()

    Local $sMySqlStatement ;~ run the UDF _DbStart
    $aStartTimeLastOrder = "SELECT ADDTIME(NOW(),'01:00:00')  FROM DUAL;"
    Global $aStartTimeLastOrder1 = _EzMySql_GetTable2d($aStartTimeLastOrder)
    $error = @error
    If Not IsArray($aStartTimeLastOrder1) Then MsgBox(0, $sMySqlStatement & " error", $error)

    Global $sOut_Date = $aStartTimeLastOrder1[1][0]
    ;Msgbox (0, "Date", $aStartTimeLastOrder1[1][0])

    _EzMySql_Close()
    _EzMySql_ShutDown()
EndFunc   ;==>date

GUICtrlSetState(-1, $GUI_FOCUS)

GUISetState()
_WinAPI_SetFocus(ControlGetHandle("Comisionare depozit v0.2", "", $input))

Comenzi_Deschise()
Verificare_Status()

While 1
    Sleep(30000)
    Verificare_Status()
    Comenzi_Deschise()
WEnd

Func Confirmare_Comisionare()
    Beep(750, 750)

    date()
    $t_data1 = "'" & $sOut_Date & "'"

    Database_start()

    If GUICtrlRead($input) > 22 Then
        $comanda_com = "'" & GUICtrlRead($input) & "'"
    Else
        Global $ab = _GUICtrlListView_GetItemTextArray($lista, -1)
        Global $comanda_com = $ab[2]
    EndIf

    $iesire1st = "UPDATE depozit SET ifm_status ='Comisionat'  WHERE ifm_comanda= " & $comanda_com & ""
    If Not _EzMySql_Exec($iesire1st) Then
        MsgBox(0, "Error Creating Database Table", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
        Exit
    EndIf

    $iesire1st = "UPDATE depozit SET  ifm_data_comisionare= " & $t_data1 & " WHERE ifm_comanda= " & $comanda_com & ""
    If Not _EzMySql_Exec($iesire1st) Then
        MsgBox(0, "Error Creating Database Table", "Error: " & @error & @CR & "Error string: " & _EzMySql_ErrMsg())
        Exit
    EndIf

    _EzMySql_Close()
    _EzMySql_ShutDown()

    Comenzi_Deschise()

    Verificare_Status()
    GUICtrlSetData($input, "")
    _WinAPI_SetFocus(ControlGetHandle("Main", "", $input))
    Beep(2000, 800)
EndFunc   ;==>Confirmare_Comisionare

Func Printare()
    Beep(1000, 1000)

EndFunc   ;==>Printare

Func Comenzi_Deschise()

    _GUICtrlListView_DeleteAllItems($lista)

    Database_start()

    $interogare = "SELECT * FROM `depozit` WHERE `ifm_status` = 'deschis' ORDER BY id ASC"

    Global $aOk = _EzMySql_GetTable2d($interogare)
    $error = @error
    If Not IsArray($aOk) Then Sleep(50)

    ;_ArrayDisplay ($aOk, "fd")
    _GUICtrlListView_AddArray($lista, $aOk)
    Sleep(40)

    _GUICtrlListView_DeleteItem($lista, 0)

    _EzMySql_Close()
    _EzMySql_ShutDown()

    Verificare_Status()
    _WinAPI_SetFocus(ControlGetHandle("Comisionare depozit v0.2", "", $input))
EndFunc   ;==>Comenzi_Deschise

Func Comenzi_Inchise()

    _GUICtrlListView_DeleteAllItems($lista)

    Database_start()

    $interogare = "SELECT * FROM `depozit` WHERE `ifm_status` = 'Comisionat' ORDER BY id ASC"

    Global $aOk = _EzMySql_GetTable2d($interogare)
    $error = @error
    If Not IsArray($aOk) Then Sleep(50)

    ;_ArrayDisplay ($aOk, "fd")
    _GUICtrlListView_AddArray($lista, $aOk)
    Sleep(40)
    _GUICtrlListView_DeleteItem($lista, 0)

    _EzMySql_Close()
    _EzMySql_ShutDown()

EndFunc   ;==>Comenzi_Inchise

Func Toate_Comenziile()
    _GUICtrlListView_DeleteAllItems($lista)

    Database_start()

    $interogare = "SELECT * FROM `depozit` WHERE 1 ORDER BY id ASC"

    Global $aOk = _EzMySql_GetTable2d($interogare)
    $error = @error
    If Not IsArray($aOk) Then Sleep(50)

    ;_ArrayDisplay ($aOk, "fd")
    _GUICtrlListView_AddArray($lista, $aOk)
    Sleep(40)
    _GUICtrlListView_DeleteItem($lista, 0)

    _EzMySql_Close()
    _EzMySql_ShutDown()

    Verificare_Status()
EndFunc   ;==>Toate_Comenziile

Func Verificare_Status()
    Database_start()
    $interogare = "SELECT * FROM `depozit` WHERE `ifm_status` = 'deschis' ORDER BY id ASC"

    Global $aOk = _EzMySql_GetTable2d($interogare)
    $error = @error
    If Not IsArray($aOk) Then Sleep(50)

    $iRows = UBound($aOk, $UBOUND_ROWS)

    If $iRows > 1 Then
        GUICtrlSetData($status, "Comenzi Deschise: " & $iRows - 1)
        GUICtrlSetColor(-1, "0xFF0000")
    Else
        GUICtrlSetData($status, "Nu exista comenzi deschise")
        GUICtrlSetColor(-1, "0x00FF00")
    EndIf

    If $iRows - 1 > 3 Then
        ;_CommAPI_TransmitString($hFile, "1")
        ;If @error Then Return SetError(@error, @ScriptLineNumber)
    EndIf

    If $iRows - 1 <= 2 Then
        ;_CommAPI_TransmitString($hFile, "2")
        ;If @error Then Return SetError(@error, @ScriptLineNumber)
    EndIf

    _EzMySql_Close()
    _EzMySql_ShutDown()

EndFunc   ;==>Verificare_Status

Func copiere()

    Global $ab = _GUICtrlListView_GetItemTextArray($lista, -1)
    Global $nrcom = $ab[2]
    ;msgbox(0, "", $nrcom)
    ClipPut($nrcom)

EndFunc   ;==>copiere

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Is working, thanks!

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