yousefsamy Posted July 14, 2014 Share Posted July 14, 2014 i want to repeat my function for number of times which i typed in input box Here is my Code expandcollapse popup#include <ImageSearch.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #RequireAdmin $x1 = 0 $y1 = 0 $Form1_1 = GUICreate("Eo", 179, 129, 417, 343) GUISetBkColor(0x008080) $input = GUICtrlCreateInput("", 36, 36, 102, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetBkColor(-1, 0xBFCDDB) $label = GUICtrlCreateLabel("Number Of Times", 48, 16, 86, 17) $Label1 = GUICtrlCreateLabel("++Exit = Esc", 48, 72, 63, 17) $Label2 = GUICtrlCreateLabel("++Start = F1", 48, 96, 62, 17) $o = GUICtrlRead($input) GUISetState(@SW_SHOW) Func _1() Do $iResult = _ImageSearch("1.bmp",1,$x1,$y1,80) If $iResult <> 1 Then Sleep(100) Until $iResult = 1 MouseClick("left",$x1,$y1,1,10) MouseMove(0,0,40) EndFunc Func Terminate() Exit 0 EndFunc Func _11() For $i = 1 To $input ; here i want to play the func to the number i typed in inputBox _1() Next EndFunc HotKeySet("{F1}","_11") HotKeySet("{ESC}", "Terminate") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
JohnOne Posted July 14, 2014 Share Posted July 14, 2014 For $i = 1 To Int(GUICtrlRead(input)) 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...
yousefsamy Posted July 14, 2014 Author Share Posted July 14, 2014 THnx Alot and 1 more question about how to make a pause button in this script Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 14, 2014 Moderators Share Posted July 14, 2014 GuictrlCreateButton("pause", 10, 10, 60, 40) - If you are asking something else, you need to be more specific... "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...
yousefsamy Posted July 14, 2014 Author Share Posted July 14, 2014 JLogan3o13 Hay what's Up i said button to pause the script i mean the code of pause not this code really i know that Link to comment Share on other sites More sharing options...
BrewManNH Posted July 14, 2014 Share Posted July 14, 2014 What are you trying to pause, and what have your searches of the forums come up with? This question is asked at least once a month with pretty much the same answers given every time. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
yousefsamy Posted July 14, 2014 Author Share Posted July 14, 2014 ok Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 14, 2014 Moderators Share Posted July 14, 2014 JLogan3o13 Hay what's Up i said button to pause the script i mean the code of pause not this code really i know that I know you meant the code of the pause. I also know you refuse to do forum searches, or look through the help file, as you are constantly directed to do. As has been asked numerous times with you, what have you tried on your own? "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...
yousefsamy Posted July 14, 2014 Author Share Posted July 14, 2014 JLogan3o13 really i learned many codes from help file,, but i am asking about that because it's relation to this topic Link to comment Share on other sites More sharing options...
yousefsamy Posted July 15, 2014 Author Share Posted July 15, 2014 i can't understand this code Global $pause ; why is it global ? Func pause() $pause = Not $pause ; what is the benefit of this line ?? While $pause Sleep(100) WEnd EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted July 15, 2014 Share Posted July 15, 2014 Best and easiest pause is... Func _Pause() MsgBox(0, "Paused", "Resume?") EndFunc 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...
yousefsamy Posted July 15, 2014 Author Share Posted July 15, 2014 (edited) yea it's a very nice idea thnx ,, but please i want to understand the first code which i posted Edited July 15, 2014 by yousefsamy Link to comment Share on other sites More sharing options...
JohnOne Posted July 15, 2014 Share Posted July 15, 2014 You wrote the code, you tell me why it's global. 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...
yousefsamy Posted July 15, 2014 Author Share Posted July 15, 2014 hhh i don't know really Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 15, 2014 Moderators Share Posted July 15, 2014 yousefsamy, Global $pause ; why is it global ? Func pause() $pause = Not $pause ; what is the benefit of this line ?? While $pause Sleep(100) WEnd EndFunc- 1. You need Global because if it were declared as Local inside the function the variable is destroyed each time the function exits - so it needs to exist outside the function. You could get the same effect by using a Static Local variable inside the function as that is not destroyed when the function ends.- 2. The Not line toggles the variable. If it were declared correctly ($pause = False) then that line will flip-flop it between True & False - so the code knows whether to pause or not.Clearer? M23 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...
yousefsamy Posted July 15, 2014 Author Share Posted July 15, 2014 yea it's clear thnx 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