naru Posted July 22, 2017 Posted July 22, 2017 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
Trong Posted July 22, 2017 Posted July 22, 2017 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 Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
naru Posted July 23, 2017 Author Posted July 23, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now