chrisgreece Posted October 21, 2014 Share Posted October 21, 2014 (edited) Greetings This is my second post that i upload. I need a help with something "obviously" #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt('WinWaitDelay',100) Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") GUICreate("A", 515, 310, -1, -1) $Input1 = GUICtrlCreateEdit("Input1", 150, 80, 129,60) GUICtrlSetOnEvent(-1, "Input1Change") $Button1 = GUICtrlCreateButton("eyresh", 272, 96, 75, 25) GUICtrlSetOnEvent(-1, "Button1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func Button1Click() $read1=GuiCtrlRead($Input1) _WinWaitActivate("Program Manager","") MouseClick("left",264,463,2) _WinWaitActivate("Open ""a""","") Send("{SHIFTDOWN}{TAB}{SHIFTUP}005188{TAB}005188{ENTER}") _WinWaitActivate("FileMaker Pro","") Send("{ENTER}") _WinWaitActivate("FileMaker Pro - [a]","") MouseClick("left",727,303,1) MouseClick("left",596,672,1) Send('{CTRLDOWN}''f''{CTRLUP}') Send(GUICtrlRead($Input1)) Send('{ENTER}') MouseClick("left",896,341,1) MouseClick("left",1337,17,1) EndFunc Func Form1Close() EndFunc Func Form1Maximize() EndFunc Func Form1Minimize() EndFunc Func Form1Restore() EndFunc Func Input1Change() EndFunc I have made this simple form here and when i run the form i can write the protocol of the client at the inputbox i want the procedure to run and when i press the button it runs on the protocol i have typed in the input box .How is it possible to write in that same input the number of for example 5000 clients and loop the procedure for every protocol from the beggining?I tried but it only accepts 1 protocol each time. Edited October 21, 2014 by chrisgreece Link to comment Share on other sites More sharing options...
JohnOne Posted October 21, 2014 Share Posted October 21, 2014 Please refer to the two answers in the first thread uploaded that you ignored, which is more or less the exact same question. 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...
chrisgreece Posted October 21, 2014 Author Share Posted October 21, 2014 Please refer to the two answers in the first thread uploaded that you ignored, which is more or less the exact same question. No i didnt ignore that but as i was searching i found the GUICtrlCreateEdit which shows a list,Because the protocols i am inserting are different each time and for example i maybe insert more than 20 protocols i want the procedure to loop from the very beggining each time the procedure finishes every protocol! Link to comment Share on other sites More sharing options...
kylomas Posted October 22, 2014 Share Posted October 22, 2014 (edited) chrisgreece, You will find it easier to get help if you post your code using code tags. See my sig for how to do that. If you want to process multiple entries each time your button is pushed then: expand your edit control to more than 60 pixels read the data in the edit control into an array loop on the array, calling what is currently under button1click for each element The following is a skeleton to get you started... expandcollapse popup#include <StringConstants.au3> #include <GUIConstantsEx.au3> #include <array.au3> #AutoIt3Wrapper_Add_Constants=n Opt("GUIOnEventMode", 1) ; create gui and controls Local $gui010 = GUICreate('Example', 400, 400) Local $edt010 = GUICtrlCreateEdit('', 20, 20, 360, 330) Local $btn010 = GUICtrlCreateButton('Process Protocols', 20, 365, 360, 30) GUISetState() ; set events for gui and controls GUISetOnEvent($GUI_EVENT_CLOSE, '_System_Action') GUISetOnEvent($GUI_EVENT_MINIMIZE, '_System_Action') GUISetOnEvent($GUI_EVENT_MAXIMIZE, '_System_Action') GUICtrlSetOnEvent($btn010, '_Process_Protocols') ; idle loop While 1 Sleep(500) WEnd ; function to process when the button is pushed Func _Process_Protocols() Local $str = GUICtrlRead($edt010) ; reads all liines of edit control Local $aProtocols = StringSplit($str, @CRLF, $STR_ENTIRESPLIT) ; creates an array of the lines read ; process each line from the edit control for $i = 1 to $aProtocols[0] ; ; do whatever you want for each line of the edit control, call another function perhaps... ; ConsoleWrite($aProtocols[$i] & @CRLF) ; just to show what happens next EndFunc ;==>_Process_Protocols Func _System_Action() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE GUIDelete($gui010) Exit Case $GUI_EVENT_MINIMIZE GUISetState(@SW_MINIMIZE) Case $GUI_EVENT_MAXIMIZE GUISetState(@SW_MAXIMIZE) EndSwitch EndFunc ;==>_System_Action kylomas edit: spelling Edited October 22, 2014 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
chrisgreece Posted October 22, 2014 Author Share Posted October 22, 2014 Thanks!I appreciate!I will try it as soon as i get back home! Link to comment Share on other sites More sharing options...
chrisgreece Posted October 22, 2014 Author Share Posted October 22, 2014 (edited) so look what i did to tell my if i am on good way. Sorry for making so dumb questions though. expandcollapse popup#include <StringConstants.au3> #include <GUIConstantsEx.au3> #include <array.au3> #AutoIt3Wrapper_Add_Constants=n Opt("GUIOnEventMode", 1) ; create gui and controls Local $gui010 = GUICreate('Example', 400, 400) Local $edt010 = GUICtrlCreateEdit('', 20, 20, 360, 330) Local $btn010 = GUICtrlCreateButton('Process Protocols', 20, 365, 360, 30) GUISetState() ; set events for gui and controls GUISetOnEvent($GUI_EVENT_CLOSE, '_System_Action') GUISetOnEvent($GUI_EVENT_MINIMIZE, '_System_Action') GUISetOnEvent($GUI_EVENT_MAXIMIZE, '_System_Action') GUICtrlSetOnEvent($btn010, '_Process_Protocols') ; idle loop While 1 Sleep(500) WEnd Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc ; function to process when the button is pushed Func _Process_Protocols() Local $str = GUICtrlRead($edt010) ; reads all liines of edit control Local $aProtocols = StringSplit($str, @CRLF, $STR_ENTIRESPLIT) ; creates an array of the lines read ; process each line from the edit control for $i = 1 to $aProtocols[1] ;Next ; do whatever you want for each line of the edit control, call another function perhaps... Local $str = GUICtrlRead($edt010) _WinWaitActivate("Program Manager","") MouseClick("left",264,463,2) _WinWaitActivate("Open ""a""","") Send("{SHIFTDOWN}{TAB}{SHIFTUP}005188{TAB}005188{ENTER}") _WinWaitActivate("FileMaker Pro","") Send("{ENTER}") _WinWaitActivate("FileMaker Pro - [a]","") MouseClick("left",727,303,1) MouseClick("left",596,672,1) Send('{CTRLDOWN}''f''{CTRLUP}') Send(GUICtrlRead($edt010)) Send('{ENTER}') MouseClick("left",896,341,1) MouseClick("left",1337,17,1) ; ConsoleWrite($aProtocols[$i] & @CRLF) ; just to show what happens Next EndFunc ;==>_Process_Protocols Func _Process_Protocols1() $read1=GuiCtrlRead($edt010) _WinWaitActivate("Program Manager","") MouseClick("left",264,463,2) _WinWaitActivate("Open ""a""","") Send("{SHIFTDOWN}{TAB}{SHIFTUP}005188{TAB}005188{ENTER}") _WinWaitActivate("FileMaker Pro","") Send("{ENTER}") _WinWaitActivate("FileMaker Pro - [a]","") MouseClick("left",727,303,1) MouseClick("left",596,672,1) Send('{CTRLDOWN}''f''{CTRLUP}') Send(GUICtrlRead($edt010)) Send('{ENTER}') MouseClick("left",896,341,1) MouseClick("left",1337,17,1) EndFunc Func _System_Action() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE GUIDelete($gui010) Exit Case $GUI_EVENT_MINIMIZE GUISetState(@SW_MINIMIZE) Case $GUI_EVENT_MAXIMIZE GUISetState(@SW_MAXIMIZE) EndSwitch EndFunc ;==>_System_Action I am now here*posted after several hours* It makes it loop but it doesn't change to the second protoco or the third. .It just repeats the procedure with the first protocol which has been input! Edited October 22, 2014 by chrisgreece Link to comment Share on other sites More sharing options...
kylomas Posted October 22, 2014 Share Posted October 22, 2014 chrisgreece, You have missed the point of using the array. You are reading the edit control over and over. You want to process your statements once for every entry in the edit control. These entries are now in an array so instead of reading the edit control, reference the array. Figure out what I am doing in the first two statements of _Process_Protocols() and modify your code. Post back after you have made an attempt to use the array elements. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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