Sign in to follow this  
Followers 0
UnknownWarrior

F key Start/Stop? Checkbox activate? Help

19 posts in this topic

#1 ·  Posted (edited)

Well i got 4 problems,

1. Once i have made my checkbox how do i make the code for when i 'check' it, a macro will start?

2.How do i make a code for a F key to Start/Stop my program?

3. Ok im gonna make a program for a game, and say i want my char to keep clicking right click, how do i add that into coding for the loop? I just cant figure it out?

4.When i start the loop how do i have it to wait so many seconds before the char right clicks again? I know u use the (Sleep) feature but i still don't know how to add that in the whole coding :geek: ?

If someone wants to help can you please post the code in all, like how i would write it in the program, not just seperate for each question but put it all together?

Thank you so much guys, help would be appreciated :o

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites



1. Once i have made my checkbox how do i make the code for when i 'check' it, a macro will start?

You'll have to check the state of the checkbox, i.e.

If BitAnd($checkbox, $GUI_CHECKED) = $GUI_CHECKED Then
   ; put your code here to do what you want
EndIf

2.How do i make a code for a F key to Start/Stop my program?

Lookup HotKeySet in the help

3. Ok im gonna make a program for a game, and say i want my char to keep clicking right click, how do i add that into coding for the loop? I just cant figure it out?

Lookup MouseClick in the help

4.When i start the loop how do i have it to wait so many seconds before the char right clicks again? I know u use the (Sleep) feature but i still don't know how to add that in the whole coding :o ?

Depends on how the script is written but typically (note sleep time varies depending on need/speed)

While 1
    ; do something
     Sleep ( 200 )
Wend

If someone wants to help can you please post the code in all, like how i would write it in the program, not just seperate for each question but put it all together?

You'll find you'll get more help if you give it try, if you get stuck post the code with questions.

Welcom to the forum.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

You'll have to check the state of the checkbox, i.e.

If BitAnd($checkbox, $GUI_CHECKED) = $GUI_CHECKED Then
  ; put your code here to do what you want
EndIf

Lookup HotKeySet in the help

1.what do u mean by the state? Heres how im going to make the program, ill have a GUI box with bunch of check boxes for this game i play, eac check box representing something my char will do. So say i put checkbox 1 as 'right click' when i check the box and hit an f key it will start right clicking.

so could u give me simple code for that?

2.for number 2. do i have to have If BitAnd or just BitAnd?

3.For the F key ive looked it up and ive read the page like 5 times already today and cant find an F key start/stop ;)

Thank you for a warm greeting man :o Please help with those few last questions :geek: TY

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sorry had a little mis information on the bitand statement forgot the guictrlread part of it

here's a quick and dirty example:

#include <GuiConstants.au3>

HotKeySet("{F5}", "_Start")

GuiCreate("MyGUI", 392, 265)

$Checkbox_1 = GuiCtrlCreateCheckbox("Checkbox1", 20, 40, 100, 20)
$Checkbox_2 = GuiCtrlCreateCheckbox("Checkbox2", 20, 80, 100, 20)
$Checkbox_3 = GuiCtrlCreateCheckbox("Checkbox3", 20, 120, 100, 20)
$Button_4 = GuiCtrlCreateButton("Button4", 140, 180, 110, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_4
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Func _Start()
    If BitAND(GUICtrlRead($Checkbox_1),$GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0,"Check","$Checkbox_1 is checked")
    EndIf
    If BitAND(GUICtrlRead($Checkbox_2),$GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0,"Check","$Checkbox_2 is checked")
    EndIf
    If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0,"Check","$Checkbox_3 is checked")
    EndIf
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Sorry had a little mis information on the bitand statement forgot the guictrlread part of it

here's a quick and dirty example:

#include <GuiConstants.au3>

HotKeySet("{F5}", "_Start")

GuiCreate("MyGUI", 392, 265)

$Checkbox_1 = GuiCtrlCreateCheckbox("Checkbox1", 20, 40, 100, 20)
$Checkbox_2 = GuiCtrlCreateCheckbox("Checkbox2", 20, 80, 100, 20)
$Checkbox_3 = GuiCtrlCreateCheckbox("Checkbox3", 20, 120, 100, 20)
$Button_4 = GuiCtrlCreateButton("Button4", 140, 180, 110, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_4
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd
Exit

Func _Start()
    If BitAND(GUICtrlRead($Checkbox_1),$GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0,"Check","$Checkbox_1 is checked")
    EndIf
    If BitAND(GUICtrlRead($Checkbox_2),$GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0,"Check","$Checkbox_2 is checked")
    EndIf
    If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0,"Check","$Checkbox_3 is checked")
    EndIf
EndFunc

Sweet man! 4 more question and ill be off! thanks your the greatest!

If BitAND(GUICtrlRead($Checkbox_1),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_1 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_2),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_2 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_3 is checked")

EndIf

1.Where u have "Then" do i add that or is that just u saying that?

2.MsgBox(0,"Check","$Checkbox_3 is checked") How do i change this to right click?

MouseClick(right, 120.500) (or w/e the cooridinate would be)(0,"Check","$Checkbox_3 is checked")

would i just add mouseclick before that or how would i add it in there? can u just give simple code of this:

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_3 is checked")

with mouse click.

3. Where do i add in Stop for hotkey? and how would i do Stop? could u give simple code for that also... cause ive looked and looked and cant find that on html help file on autoit

4.Will the checkboxes start running the macro before i push the F key or will they wait until i have pushed the F key?

THANK YOU so much man, much appreciation.

EDIT: I just found new problem... first of all is this all right, i added th mouse click, is that hows it suppose to be?:::

#include <GuiConstants.au3>

HotKeySet("{F5}", "_Start")

GuiCreate("MyGUI", 392, 265)

$Checkbox_1 = GuiCtrlCreateCheckbox("Checkbox1", 20, 40, 100, 20)

$Checkbox_2 = GuiCtrlCreateCheckbox("Checkbox2", 20, 80, 100, 20)

$Checkbox_3 = GuiCtrlCreateCheckbox("Checkbox3", 20, 120, 100, 20)

$Button_4 = GuiCtrlCreateButton("Button4", 140, 180, 110, 30)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_4

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

Func _Start()

If BitAND(GUICtrlRead($Checkbox_1),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 373, 389, 2)(0,"Check","$Checkbox_1 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_2),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 373, 389, 2)(0,"Check","$Checkbox_2 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 373, 389, 2)(0,"Check","$Checkbox_3 is checked")

EndIf

EndFunc

................:::::

and now when i click run it says ERROR: GUIGetCheck()

and thats not even on my script, so some help on that and please answer me four other questions, thanks man

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites

Sweet man! 4 more question and ill be off! thanks your the greatest!

If BitAND(GUICtrlRead($Checkbox_1),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_1 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_2),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_2 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_3 is checked")

EndIf

1.Where u have "Then" do i add that or is that just u saying that?

2.MsgBox(0,"Check","$Checkbox_3 is checked") How do i change this to right click?

MouseClick(right, 120.500) (or w/e the cooridinate would be)(0,"Check","$Checkbox_3 is checked")

would i just add mouseclick before that or how would i add it in there? can u just give simple code of this:

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0,"Check","$Checkbox_3 is checked")

with mouse click.

3. Where do i add in Stop for hotkey? and how would i do Stop? could u give simple code for that also... cause ive looked and looked and cant find that on html help file on autoit

4.Will the checkboxes start running the macro before i push the F key or will they wait until i have pushed the F key?

THANK YOU so much man, much appreciation.

EDIT: I just found new problem... first of all is this all right, i added th mouse click, is that hows it suppose to be?:::

#include <GuiConstants.au3>

HotKeySet("{F5}", "_Start")

GuiCreate("MyGUI", 392, 265)

$Checkbox_1 = GuiCtrlCreateCheckbox("Checkbox1", 20, 40, 100, 20)

$Checkbox_2 = GuiCtrlCreateCheckbox("Checkbox2", 20, 80, 100, 20)

$Checkbox_3 = GuiCtrlCreateCheckbox("Checkbox3", 20, 120, 100, 20)

$Button_4 = GuiCtrlCreateButton("Button4", 140, 180, 110, 30)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_4

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

Func _Start()

If BitAND(GUICtrlRead($Checkbox_1),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 373, 389, 2)(0,"Check","$Checkbox_1 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_2),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 373, 389, 2)(0,"Check","$Checkbox_2 is checked")

EndIf

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 373, 389, 2)(0,"Check","$Checkbox_3 is checked")

EndIf

EndFunc

................:::::

and now when i click run it says ERROR: GUIGetCheck()

and thats not even on my script, so some help on that and please answer me four other questions, thanks man

yo man can u please reply to my last questions, then ill be off and outta your way :o

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

1.Where u have "Then" do i add that or is that just u saying that?

check out the If...Then in the Keyword Reference of the Help

2.MsgBox(0,"Check","$Checkbox_3 is checked") How do i change this to right click?

MouseClick(right, 120.500) (or w/e the cooridinate would be)(0,"Check","$Checkbox_3 is checked")

would i just add mouseclick before that or how would i add it in there? can u just give simple code of this:

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("right", 120,500)

EndIf

3. Where do i add in Stop for hotkey? and how would i do Stop? could u give simple code for that also... cause ive looked and looked and cant find that on html help file on autoit

Unless you put your start function/code into a loop what would you need a stop for? it will only run the function each time you press F5

4.Will the checkboxes start running the macro before i push the F key or will they wait until i have pushed the F key?

Answered in with question 3

You might want to look at other scripts for example: http://www.autoitscript.com/forum/index.php?showtopic=21710

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

1.nevermind, it fixed it... but now i got problem.... , it starts the program and blah blah, and has checkbox 1,2, and 3, but when i click them and hit F5 it dont start, it just doesnt do anything... any help?

2. i know im sounding nooby with this question but i dont know what else to

Func _Start()

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 120,500)

EndIf

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 120,500)

EndIf

While 2

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

MouseClick("left", 120,500)

WEnd

EndIf

EndFunc

That is the bottom part with the checkbox things blah blah... anyways have my while 2 right there, i had while 1 earlier... whatever way i try it, it always says, ERROR: WEnd statement doesn't have a matching While statement" ITS getting on my nervs lol, whatever way i put the while icant get it to work... any help?

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites

what about my problem tho? is says GUIGetCheck ERROR... i cant start the program...

Have no clue where that is coming from.

The script I posted works in release and beta with no errors.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Have no clue where that is coming from.

The script I posted works in release and beta with no errors.

i got it now.... but now i have the ONE problem left... when i start the program i have this has one of my checkbox coding...

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

While 2

MouseClick("left", 120,500)

WEnd

well... it just keeps left clciking... i just had to reboot my somputer becuz i couldnt shut it off lol... how do i add stop key?

p.s. i want the stop key to be another F key if possible... ty :o

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites

i got it now.... but now i have the ONE problem left... when i start the program i have this has one of my checkbox coding...

If BitAND(GUICtrlRead($Checkbox_3),$GUI_CHECKED) = $GUI_CHECKED Then

While 2

MouseClick("left", 120,500)

WEnd

well... it just keeps left clciking... i just had to reboot my somputer becuz i couldnt shut it off lol... how do i add stop key?

#include <GuiConstants.au3>

Opt("GUIOnEventMode",1)

HotKeySet("{F5}", "_Start")
HotKeySet("{F7}", "_NoClick")
HotKeySet("{ESC}","Terminate")
$ClickIt = False

GUICreate("MyGUI", 392, 265)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("Checkbox1", 20, 40, 100, 20)
$Checkbox_2 = GUICtrlCreateCheckbox("Checkbox2", 20, 80, 100, 20)
$Checkbox_3 = GUICtrlCreateCheckbox("Checkbox3", 20, 120, 100, 20)
$Button_4 = GUICtrlCreateButton("Button4", 140, 180, 110, 30)
GUICtrlSetOnEvent($Button_4,"Terminate")
GUISetState()
While 1
 Sleep( 10 )
WEnd
Exit

Func _Start()
 $ClickIt = True
 While $ClickIt = True
  If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
   ToolTip("Clicking 1")
  EndIf
  If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
   ToolTip("Clicking 2")
  EndIf
  If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then
   ToolTip("Clicking 3")
;~  MouseClick("left", 120, 500)
  EndIf
 WEnd
EndFunc  ;==>_Start

Func _NoClick()
 ToolTip("")
 $ClickIt = False
EndFunc  ;==>_NoClick

Func Terminate()
 Exit
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>

Opt("GUIOnEventMode",1)

HotKeySet("{F5}", "_Start")
HotKeySet("{F7}", "_NoClick")
HotKeySet("{ESC}","Terminate")
$ClickIt = False

GUICreate("MyGUI", 392, 265)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("Checkbox1", 20, 40, 100, 20)
$Checkbox_2 = GUICtrlCreateCheckbox("Checkbox2", 20, 80, 100, 20)
$Checkbox_3 = GUICtrlCreateCheckbox("Checkbox3", 20, 120, 100, 20)
$Button_4 = GUICtrlCreateButton("Button4", 140, 180, 110, 30)
GUICtrlSetOnEvent($Button_4,"Terminate")
GUISetState()
While 1
 Sleep( 10 )
WEnd
Exit

Func _Start()
 $ClickIt = True
 While $ClickIt = True
  If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
   ToolTip("Clicking 1")
  EndIf
  If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
   ToolTip("Clicking 2")
  EndIf
  If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then
   ToolTip("Clicking 3")
;~  MouseClick("left", 120, 500)
  EndIf
 WEnd
EndFunc ;==>_Start

Func _NoClick()
 ToolTip("")
 $ClickIt = False
EndFunc ;==>_NoClick

Func Terminate()
 Exit
EndFunc
1. wow your amazing lol...

2.it has an error tho... when i run the program it says ERROR: $ClickIt = False or Click it=true

any more help? with this script i should be able to add many things and get it to work finally... :o

Share this post


Link to post
Share on other sites

1. wow your amazing lol...

2.it has an error tho... when i run the program it says ERROR: $ClickIt = False or Click it=true

any more help? with this script i should be able to add many things and get it to work finally... :o

just change that to 0 for false and 1 for true

forgot, running beta


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

just change that to 0 for false and 1 for true

forgot, running beta

good good, its working.. but now it wont even click anymore...

While $ClickIt = 1

If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then

ToolTip("Clicking 1")

EndIf

If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then

ToolTip("Clicking 2")

EndIf

If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then

ToolTip("Clicking 3")

;~ MouseClick("left", 120, 500)

EndIf

WEnd

EndFunc ;==>_Start

1.when i click the checkbox 3, it just says "Clicking 3" for that tool tip thing... do i need the tool tip?

2.how do i get it to start clicking? when i press F5 once checkbox 3 is checked it just says "Clicking 3" ;)

EDIT: NEVERMIND that post! i just took out tool tips and did my old coding.. works great now :sorcerer: thx man :o... im sure in few days or maybe even tmr ill be back... for now, your the best :geek:

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites

Yo gafrost, is there anyway to have the program working while your viewing something else? EXAMPLE:

Im playing my game and i want my char to right click forever til i stop it for he lvls, well it will take a while to lvl so i would go to mozilla firefox and play miniclip games wwhile the macro is right clicking.

Is there anyway to do it that way as i gave in my example? Cause my friends are screaming for that lol, cuz it would be awesome if that can happen. Ty most help appreciated, hope when you reply you have my solution :o.

Share this post


Link to post
Share on other sites

Yo gafrost, is there anyway to have the program working while your viewing something else? EXAMPLE:

Im playing my game and i want my char to right click forever til i stop it for he lvls, well it will take a while to lvl so i would go to mozilla firefox and play miniclip games wwhile the macro is right clicking.

Is there anyway to do it that way as i gave in my example? Cause my friends are screaming for that lol, cuz it would be awesome if that can happen. Ty most help appreciated, hope when you reply you have my solution :o.

Sorry for double post but i had idea, when i was reading the html help thing a while back i saw something called $WINMINIZED... Would this have anything to do with what im asking for? if so or not can you still supply a code for it gafrost, the rest of my program i shouldnt need much help, but my friends are demanding this for they can go afk for awhile, while there on the internet.

Share this post


Link to post
Share on other sites

Bump, i really need alot of help here :o

Share this post


Link to post
Share on other sites

ok heres alot of problems i got...

1.F7 for stop aint working anymore :o

2.how do i get it for once it says like Insufficient mana it will do other clicking?this one i need the most details on please

3.how do i have it for the macro works in another window as say im looking at the internet or something?

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Bring

Up

My

Post

Edited by UnknownWarrior

Share this post


Link to post
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
Sign in to follow this  
Followers 0