Jump to content

InputBox and function


Recommended Posts

i want to repeat my function for number of times which i typed in input box

Here is my Code

#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

  • Moderators

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

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 Gude
How 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

  • Moderators

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...