Jump to content

Recommended Posts

Posted

Okey guys , here's the thing, My script is running fine, but when it's already running i cant   turn it off or pause by clicking the on/off button  unless i manually close it on my taskbar. What i wanted to happen is "if i click the ($switch = turn On and Off Button) to Off the script will STOP Running but not closing the entire GUI because i tried to use Exit and ExitLoop but it closes the entire GUI. and i don't want that to happen.  

BTW. I'm new in AutoIT and practice scripting hope somebody could help me :) Godbless. feel free to view my script

Practice.au3

Posted (edited)
23 minutes ago, Ian_Mac said:

Okey guys , here's the thing, My script is running fine, but when it's already running i cant   turn it off or pause by clicking the on/off button  unless i manually close it on my taskbar. What i wanted to happen is "if i click the ($switch = turn On and Off Button) to Off the script will STOP Running but not closing the entire GUI because i tried to use Exit and ExitLoop but it closes the entire GUI. and i don't want that to happen.  

BTW. I'm new in AutoIT and practice scripting hope somebody could help me :) Godbless. feel free to view my script

Practice.au3

So I am looking at your "onOff" function.  This line:
If $readInput ==  $readInput Then

What is that meant to accomplish?  First, since it is going to be a number (since that is what the control style specified), it would be "If $readinput = $readinput then", but why is this even in the script.  It will always return true.  That being the case, why is it there?  Go into some more detail as to what you want "onoff" to do...

Edited by MattHiggs
Posted (edited)

 

15 hours ago, MattHiggs said:

So I am looking at your "onOff" function.  This line:
If $readInput ==  $readInput Then

What is that meant to accomplish?  First, since it is going to be a number (since that is what the control style specified), it would be "If $readinput = $readinput then", but why is this even in the script.  It will always return true.  That being the case, why is it there?

 i got what u mean i can do it "If $readInput then" isntead of using == but that's not the problem. what i wanted is to stop the while loop if i turn off the button but not closing the entire gui. because exit and exitloop totally close the entire GUI

Edited by Ian_Mac
Posted
8 minutes ago, Ian_Mac said:

 

its,  take the inputted number or the value from the ($time = the input box ) then after taking  it multiply it to 1000 then it send msgbox of the answer which means if i input 1 it will multiply to 1000 so 1*1000 = msgbox "You Inputed: 1000"  then after that run the while loop. and that's where my problem is i cant stop the loop  by turing off button by clicking the button to off. 

The reason that it won't turn back off is because of this code here:

While 1
                        Send("0")
                        Sleep($readInput)
                     WEnd

While 1 creates an infinate loop, and the contents of the loop are to press the "0" key and then pause the script for the amount of time entered into the input with no way to break out of the loop.  You have given me a summary of only the first couple of lines of code.  In order for me to help, I need to know what you are trying to accomplish in its entirety, otherwise when I see code like the above, I don't know what you are trying to do

Posted

im just practicing the buttons . just trying to stop the while loop. but if u mean asking me what program im gonna do. idont have idea im just trying to learn the autoit for future use. 

i newbie and trying to learn programming

Posted

Ah I see.  In that case, that while loop is what is causing the issue.  I can appreciate you are trying to learn, so I would recommend, rather than go about it like this, take a look at these resources first.  These will help:

https://www.autoitscript.com/forum/files/file/351-learn-to-program-using-free-tools-with-autoit/

https://www.autoitscript.com/forum/files/file/100-welcome-to-autoit-1-2-3/

And to just explore the other resources that the community has created:

https://www.autoitscript.com/forum/files/

I would also highly recommend going over the help file in great detail (if you are using SciteforAutoIt then just press F1 when you have clicked inside the text editor window.

Posted

i have tried to read , googled watch vids.  but i cant find answers.  please help me what code to use. just to stop that loop without exiting.

Posted
4 minutes ago, Ian_Mac said:

i have tried to read , googled watch vids.  but i cant find answers.  please help me what code to use. just to stop that loop without exiting.

Dude.  I can't help you if I don't know what you want to accomplish.  If you are simply trying to display a message box with the number entered into the GUI's input box multiplied by 1000, then there is not need for that loop.  Like I said, " While 1 creates an infinate loop, and the contents of the loop are to press the "0" key and then pause the script for the amount of time entered into the input with no way to break out of the loop."  If you want to break the infinate loop, you need to either a) change the conditions of the While loop or B) put an "exitloop" statement somewhere in the while loop.  But if I don't know what you are trying to accomplish, then I can't help you.  I would need to know why you wanted to put the loop there in order to help you fix it.  I need to be able to follow your logic, or else, its like trying to catch smoke with my bare hands.

Posted

okey, ahhm, i wanted to auto press that 0 key while  my button is on and i already did it using while 1 right?.. and then now  i wanted it to stop if i turned it off .

maybe your right to change the condition of the while loop. so how to code it or change it i'm stock ? thanks for the reply sir i really appreciated it :) 

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
×
×
  • Create New...