litlmike Posted August 11, 2006 Share Posted August 11, 2006 How can I call this only when the counter is divisble by 5? Example: Lets say that I have this function, but I only want it to call Func Msg_Box every 5th time. $i = 0 While $i < 100 Func Msg_Box () $i +=1 WEnd Func Msg_Box () MsgBox(4096, "Test", "This box will time out in 1 second", 1) Sleep (2000) EndFunc _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
GaryFrost Posted August 11, 2006 Share Posted August 11, 2006 For $i = 0 To 99 If Not Mod($i,5) Then Msg_Box () Next Func Msg_Box () MsgBox(4096, "Test: " & $i, "This box will time out in 1 second", 1) Sleep (2000) EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
litlmike Posted August 11, 2006 Author Share Posted August 11, 2006 For $i = 0 To 99 If Not Mod($i,5) Then Msg_Box () Next Func Msg_Box () MsgBox(4096, "Test: " & $i, "This box will time out in 1 second", 1) Sleep (2000) EndFuncHa! Thanks, I thought it would be much trickier to solve. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
litlmike Posted August 11, 2006 Author Share Posted August 11, 2006 Actually, to play Devil's Advocate, is there a way to do this without using Mod()? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
BPBNA Posted August 11, 2006 Share Posted August 11, 2006 Whats wrong with Mod? It works fine. You could always do the division yourself and check for a decimal. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 Actually, to play Devil's Advocate, is there a way to do this without using Mod()?For $i = 0 To 99 If IsInt($i / 5) Then Msg_Box () Next Func Msg_Box () MsgBox(4096, "Test: " & $i, "This box will time out in 1 second") Sleep(2000) EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now