jops1987 Posted May 4, 2014 Share Posted May 4, 2014 (edited) expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $test = GUICreate("test", 193, 162, 580, 338, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetFont(8, 400, 0, "Microsoft Sans Serif") GUISetBkColor(0xFFFFFF) $startbutton = GUICtrlCreateButton("START", 8, 135, 75, 25) $stopbutton = GUICtrlCreateButton("STOP", 112, 135, 75, 25) $Label0 = GUICtrlCreateLabel("test", 8, 8, 189, 17) $Label2 = GUICtrlCreateLabel("number", 69, 35, 53, 17) $Label3 = GUICtrlCreateLabel("Delay", 82, 82, 101, 17) $Delay = GUICtrlCreateInput("", 37, 95, 121, 21) $number = GUICtrlCreateInput("", 37, 48, 121, 21, $ES_NUMBER) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $startbutton If WinExists("notepad") Then WinActivate("notepad") $num = GUICtrlRead($number) $sleep = GUICtrlRead($Delay) While 1 Send($num) Sleep($sleep) WEnd Else MsgBox(1, "Error!", "notepad is not running!") EndIf Case $msg = $stopbutton Exit Case $msg = $GUI_EVENT_CLOSE GUIDelete() Exit EndSelect WEnd Any advice will be appreciate Edited May 4, 2014 by jops1987 Link to comment Share on other sites More sharing options...
libreau3 Posted May 4, 2014 Share Posted May 4, 2014 I made some improvements with the notepad conditional, and the stop button works now. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $test = GUICreate("test", 193, 162, 580, 338, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS)) GUISetFont(8, 400, 0, "Microsoft Sans Serif") GUISetBkColor(0xFFFFFF) $startbutton = GUICtrlCreateButton("START", 8, 135, 75, 25) $stopbutton = GUICtrlCreateButton("STOP", 112, 135, 75, 25) $Label0 = GUICtrlCreateLabel("test", 8, 8, 189, 17) $Label2 = GUICtrlCreateLabel("Number", 69, 35, 53, 17) $Label3 = GUICtrlCreateLabel("Delay (ms)", 82, 82, 101, 17) $Delay = GUICtrlCreateInput("", 37, 95, 121, 21) $number = GUICtrlCreateInput("", 37, 48, 121, 21, $ES_NUMBER) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $startbutton If WinExists("[CLASS:Notepad]") Then WinActivate("[CLASS:Notepad]") _Sender() Else Run("notepad.exe") WinWait("[CLASS:Notepad]","") _Sender() EndIf Case $msg = $stopbutton Exit Case $msg = $GUI_EVENT_CLOSE GUIDelete() Exit EndSelect WEnd Func _Sender() WinActivate("[CLASS:Notepad]") $num = GUICtrlRead($number) $sleep = GUICtrlRead($Delay) While 1 Send($num) For $i = 0 To $sleep / 100 Sleep(Floor($sleep / 100)) $nMsg = GUIGetMsg() If $nMsg = $stopbutton Then Exit Next WEnd EndFunc ;==>_Sender Link to comment Share on other sites More sharing options...
jops1987 Posted May 4, 2014 Author Share Posted May 4, 2014 thx for fast respond Link to comment Share on other sites More sharing options...
jops1987 Posted May 4, 2014 Author Share Posted May 4, 2014 thanx that works great, however i now have a new problem. I wan in inputbox Dealy on my gui that place a function as a sleep, so it sleeps for each number in the inputbox can anyone give me some tips will be appreciate Link to comment Share on other sites More sharing options...
libreau3 Posted May 5, 2014 Share Posted May 5, 2014 I don't understand what you mean. Can you elaborate? Link to comment Share on other sites More sharing options...
jops1987 Posted May 5, 2014 Author Share Posted May 5, 2014 Well in the inputbox when someone put a number like : 123456 in each number have a delay Link to comment Share on other sites More sharing options...
JohnOne Posted May 5, 2014 Share Posted May 5, 2014 How will you determine each number? You see it could be Input 123456 Sleeps 1 23 456 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TrickyDeath Posted May 7, 2014 Share Posted May 7, 2014 As i could understand you wana do your sleep time like = 123456 will have 6 different delay time right? Like first number, second number ... etc? I guess it will be bit complicate, if you can do it. Inputbox have a value what is a string or int. When you read the value, you get back the number of 123456. Better to use multiple input box for different sleeping time, or make an ini (setup) file where you can store your delay times. Maybe someone with much more experience will come out with better solution. Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei) Link to comment Share on other sites More sharing options...
JohnOne Posted May 7, 2014 Share Posted May 7, 2014 6 sleeps can not really be assumed, plus it would make no sense since any sleep under 10 resolves to 10. Better take deliminator separated input and use StringSplit. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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