LudwigIt Posted September 10, 2018 Share Posted September 10, 2018 Good mornig, afternoon or evening, I need your help! I Keep it simple, if you dont click the button in 5 sec, the Programm click automatically without x y coordinates on the Button. my code... #include <GUIConstants.au3> #include <WinAPISys.au3> $Form1 = GUICreate("Form1", 625, 443, 190, 125) $Button1 = GUICtrlCreateButton("Button1", 88, 72, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 Run("notepad.exe") EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 10, 2018 Moderators Share Posted September 10, 2018 LudwigIt, Welcome to the AutoIt forums. A simple way to do what you want is to use a dummy control: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("Button", 10, 10, 80, 30) $cDummy = GUICtrlCreateDummy() GUISetState(@SW_SHOW) ; Set a timestamp $iTimer = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton, $cDummy ; Both events fire this code MsgBox($MB_SYSTEMMODAL, "Hi", "Button pressed") EndSwitch ; Check timestamp valid and if delay over 5 secs If $iTimer <> -1 And TimerDiff($iTimer) > 5000 Then ; Fire dummy event GUICtrlSendToDummy($cDummy) ; Invalidate timestamp - try commenting this line and see what happens!!!!!! $iTimer = -1 EndIf WEnd If you want to get a bit more complex you can differentiate between the button and the timer: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("Button", 10, 10, 80, 30) $cDummy = GUICtrlCreateDummy() GUISetState(@SW_SHOW) ; Set a timestamp $iTimer = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton, $cDummy ; Both events fire this code ; But message changes depending on the event detected If GUICtrlRead($cDummy) = 9999 Then $sMsg = "Timer fired" ; Clear the dummy data - try commenting this line and see what happens!!!!!! GUICtrlSetData($cDummy, 0) Else $sMsg = "Button pressed" EndIf MsgBox($MB_SYSTEMMODAL, "Hi", $sMsg) EndSwitch ; Check timestamp valid and if delay over 5 secs If $iTimer <> -1 And TimerDiff($iTimer) > 5000 Then ; Fire dummy event GUICtrlSendToDummy($cDummy, 9999) ; Invalidate timestamp - try commenting this line and see what happens!!!!!! $iTimer = -1 EndIf WEnd Please ask if you have any questions. M23 P.S. When you post code in future please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see in my posts above. Thanks in advance for your cooperation. LudwigIt and atanik 1 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
atanik Posted October 12, 2018 Share Posted October 12, 2018 thank you Melba23, i am intersting to do something as LudwigIt says. but there is a one differencess. i need to run one exe file and click button inside of the exe when program is minimized. is there a way to help me related with this problems please? Thank you. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 12, 2018 Moderators Share Posted October 12, 2018 @atanik you already have a thread open on this subject. Please stick to one thread. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
atanik Posted October 12, 2018 Share Posted October 12, 2018 @JLogan3o13 you are right. but i could not remove the comment. sorry for that. if possible can you remove this comment and priverios comment please? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 12, 2018 Moderators Share Posted October 12, 2018 No need to remove it, simply use your own thread from this point forward... atanik 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
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