Jump to content

Recommended Posts

Posted

I'm trying to make a script where it will do bunch of stuff and one of them requires checking the Ini.

Example:

[Testing]

Basic=Yes ;Type Yes to work or No to disable the function

$Chobyhy = IniRead("C:\Program Files\AutoIt3\beta\Config.ini", "Basic", "Testing", "Error")

While 1

If _IsPressed("11") And $Chobyhy = "Yes" Then

Send("Working")

Sleep(100)

Else

Sleep(10)

EndIf

WEnd

Thats what i have so far. But it doesnt give much option if you dont type "yes". I want it to be able to take a different action if someone typed No. How will i be able to do this

Second question: For the script above, i put Else Sleep(10). How would i make it so that it takes No action like nothing. Null action if it does not match Yes? Would Sleep(10) do the work? or is there a simpler way?

Thanks in advance

Posted

with the current script you have, if the key is not pressed and chub = something else than yes, it will do nothing.

or i am not getting what you are trying to do?

Posted (edited)

lol thats good. well should i leave the Sleep thing in? or can i remove it

Edit: One more question for you ramadash. How do you run Diablo in window mode? I know if you put Run("Diablo.exe") it will run full window but how can u make it so it goes window'd?

Edited by Chobyhy
Posted (edited)

Having a Sleep in a loop is good since it lowers CPU-usage.

$Chobyhy = IniRead("C:\Program Files\AutoIt3\beta\Config.ini", "Basic", "Testing", "Error")

While 1
    Sleep(10)
    If _IsPressed ("11") And $Chobyhy = "Yes" Then
        Send("Working")
        Sleep(100)
    EndIf
WEnd
Edit : forgot the Sleep(100)

Edited by Helge
Posted (edited)

Wait. Longer the sleep time = less cpu usage right? But whats the downfall of long sleeptime?

Naah, 10 will be good enough ! The downfall can be slower response.. :P Edited by Helge
Posted

there aint really any downfall if you dont set the sleep too high, Sleep( 10 ) will sleep for 1/100th of a second, you could even do Sleep( 100 ) and you wont notice any difference.

Posted

there aint really any downfall if you dont set the sleep too high, Sleep( 10 ) will sleep for 1/100th of a second, you could even do Sleep( 100 ) and you wont notice any difference.

Ok, wait a sec... For a thing like this

While 1
     ;Should there be a sleep here???
     If $button then Msgbox(0, "", "WHATEVER")
     If $button1 then Msgbox(0, "", "WHATEVER1")
     If $button2 then Msgbox(0, "", "WHATEVER2")
     If $button3 then Msgbox(0, "", "WHATEVER2")
Wend

Would that not go 100% CPU usage if there was a sleep in it? I always thought sleeps in loops were bad...

Sincerely confused, Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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