Jump to content

Loop help...


Recommended Posts

Probably a really simple asnwer...but how can i make a loop, like pressing B, but the delay time is specified by an input box?

Also...how can i set a picture as the background?

Here is something I tried with the loop thing...

CODE
While 1

Sleep (GUICtrlCreateInput("Insert Delay Value In Seconds...", 55, 120, 110, 20))

If $F7OnOff Then Send('b')

Wend

I dont think its right...since it doesn't work... but please help me!

Edited by ssjfulkon198
Link to comment
Share on other sites

Have the input create separate, then get the value in it by using GUICtrlRead()

Example:

$input = GUICtrlCreateInput("Insert Delay Value In Seconds...", 55, 120, 110, 20) ; creates input

While 1
    $read = GUICtrlRead($input) ; reads value from input
    Send("b") ; sends "b"
    Sleep($read) ; sleeps amount of time(in milliseconds) specified in input
WEnd

What do you mean by the loop?

EDIT: Did I get it right?

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Global $F7OnOff 
HotKeySet("{F7}", "ToggleF7")

$delay = InputBox("Title","Insert Delay Value In Seconds...")
$delay = $delay * 1000

While 1
   Sleep ($delay)
   If $F7OnOff Then Send('b')
Wend

Func ToggleF7()
    $F7OnOff = NOT $F7OnOff 
EndFunc

Advice: For GUI applications use Koda. It will make AutoIt GUI code for you.

Edited by Zedna
Link to comment
Share on other sites

Run Koda and set-up what ever properties you want. Then Hit F10 and it will generate all GUI code gor you!!

Try GUICtrlSetColor

Though Koda is good an all, it's always a good idea to know how to do it without a machine :whistle:

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

is that right?

$delay = GUICtrlCreateInput("Enter Amount In Sec.", 55, 120, 110, 20, GUICtrlSetColor(0, GUICtrlSetColor (0xFFFFFF))

(for me)

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

is that right?

Ehm, not exactly.

; creates the control and stores the controlID in the $control-variable
$control = GUICtrlCreateInput("Enter Amount In Sec.", 55, 120, 110, 20)

 ; use controlID to change the control's text-color to white
GUICtrlSetColor($control, 0xFFFFFF)
 ; use controlID to change the control's back-color to black
GUICtrlSetBkColor($control, 0x0)
;...

 ; read the control's current value and stores it in the $value-variable
$value = GUICtrlRead($control)
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...