Jump to content

My first GUI - Need Some Help


Recommended Posts

So ive been a long time coder. Now i would like to step up my game a little.

Basically I would like to know how to take the value from the input bar and place it into my code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Label1 = GUICtrlCreateLabel("How Many Times Should This Loop?", 24, 48, 178, 17)
$InputShouldLoop = GUICtrlCreateInput("10", 216, 48, 121, 21)
$Button1 = GUICtrlCreateButton("Set Value", 384, 48, 113, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

I would like to press the

Set Value button

Then take what ever is in the input box and add to my

$ShouldLoop = $InputShouldLoop

??? How do i make it so when i press The Set Value number it changes the $ShouldLoop

MORE of what im trying to do .... should be more clear.

;MouseClick("left",810(left right),108(up down),1);Clicks Next Button For Crafting Session
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Label1 = GUICtrlCreateLabel("How Many Times Should This Loop?", 24, 48, 178, 17)
$InputShouldLoop = GUICtrlCreateInput("10", 216, 48, 121, 21)
$Button1 = GUICtrlCreateButton("Set Value", 384, 48, 113, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

Global $Paused
$loop = $InputShouldLoop   ;Loop The Program.
$i = 0      ;Start The Loop At 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d

do
;My script goes here
;My script goes here
;My script goes here
;My script goes here
MouseClick("left",244,188,2;EXAMPLE
;My script goes here
;My script goes here
;My script goes here
;My script goes here
;;How many times the program should loop then close.
$i = $i + 1
Until $i = $loop

While 1
    Sleep(100)
WEnd
;;;;;;;;
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc
Func Terminate()
    Exit 0
EndFunc
Func ShowMessage()
    MsgBox(4096,"","Has Looped "($loop)" Times")
EndFunc
Edited by NightCrawler86
Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Label1 = GUICtrlCreateLabel("How Many Times Should This Loop?", 24, 48, 178, 17)
$InputShouldLoop = GUICtrlCreateInput("10", 216, 48, 121, 21)
$Button1 = GUICtrlCreateButton("Set Value", 384, 48, 113, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
   Case $Button1
    $Shouldloop = Int(GUICtrlRead($InputShouldLoop)) ; read input to int
    _Loop($Shouldloop) ;pass it To function
EndSwitch
WEnd
Func _Loop($n) ; function
For $i = 1 To $n
  MsgBox(0,"Looping", $i)
Next
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

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...