Jump to content

How to setup button in message box


Recommended Posts

I create message box but i dont know how to add button action when i click it.

Help for : Add script for Button : Left, Right, Right Finger
example when i press Left finger button do Case $idNotepad
                $iPID = WinActivate ( " :PS :: Version - 2.8.0.0  - [eFS Bill]")
                        ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:btnReset]", "{esc}")
                        ControlClick ( " :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]")
                        ControlSend(" :DS  - eF:: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "^v")
                        ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "{enter}")
How to add like above ?
              
                                                          sorry for my bad english

Quote

#include <GUIConstantsEx.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 425, 200)

    ; Create a button control.
    Local $idlf = GUICtrlCreateButton("Left Finger", 0, 170, 85, 25)
    Local $idleft = GUICtrlCreateButton("Left", 100, 170, 85, 25)
    Local $idr = GUICtrlCreateButton("Right", 240, 170, 85, 25)
    Local $iderf = GUICtrlCreateButton("Right Finger", 340, 170, 85, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $iPID = 0

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
           Case $GUI_EVENT_CLOSE
                ExitLoop


            Case $idlf
                ; Run Notepad with the window maximized.
                $iPID = WinActivate ( " :PS :: Version - 2.8.0.0  - [eFS Bill]")
                        ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:btnReset]", "{esc}")
                        ControlClick ( " :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]")
                        ControlSend(" :DS  - eF:: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "^v")
                        ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "{enter}")

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)

    ; Close the Notepad process using the PID returned by Run.
    If $iPID Then ProcessClose($iPID)
EndFunc   ;==>Example

 

 

Link to comment
Share on other sites

see GUI Event:

While 1
        Switch GUIGetMsg()
           Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idlf
                MsgBox(64,"Oh", "You press button Left Finger")
                ; Add your code here: Do somethink when click on button "Left Finger"
            Case $idleft 
                MsgBox(64,"Oh", "You press button Left")
                ; Add your code here: Do somethink when click on button "Left"
            Case $idr
                MsgBox(64,"Oh", "You press button Right")
                ; Add your code here: Do somethink when click on button "Right"
            Case $iderf 
                MsgBox(64,"Oh", "You press button Right Finger")
                ; Add your code here: Do somethink when click on button "Right Finger"
        EndSwitch
    WEnd

 

Regards,
 

Link to comment
Share on other sites

11 hours ago, VIP said:

see GUI Event:

While 1
        Switch GUIGetMsg()
           Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idlf
                MsgBox(64,"Oh", "You press button Left Finger")
                ; Add your code here: Do somethink when click on button "Left Finger"
            Case $idleft 
                MsgBox(64,"Oh", "You press button Left")
                ; Add your code here: Do somethink when click on button "Left"
            Case $idr
                MsgBox(64,"Oh", "You press button Right")
                ; Add your code here: Do somethink when click on button "Right"
            Case $iderf 
                MsgBox(64,"Oh", "You press button Right Finger")
                ; Add your code here: Do somethink when click on button "Right Finger"
        EndSwitch
    WEnd

 

Thanks VIP

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

×
×
  • Create New...