Jump to content

Counting Loops


Recommended Posts

Hello, I am having a tid bit of trouble counting loops, heres a example of what I mean.

Func mouse()
While 1 
msg()
cc()
WEnd
EndFunc

Func msg()
$msg = 'hello this is my message'
Send($msg)
sleep(10000)
Send ($msg)
sleep(10000)
Send($msg)
sleep(10000)
Send ($msg)
sleep(10000)
EndFunc

Func cc()
Mouseclick ("left")
EndFunc

Now I can count the number in the msg func but when func mouse reloops it starts all over again. Any help?

Link to comment
Share on other sites

Func mouse()
    $count = 0
    While 1 
        msg()
        cc()
        $count += 1
    WEnd
EndFunc

Func msg()
    $msg = 'hello this is my message'
    Send($msg)
    sleep(10000)
    Send ($msg)
    sleep(10000)
    Send($msg)
    sleep(10000)
    Send ($msg)
    sleep(10000)
EndFunc

Func cc()
    Mouseclick ("left")
EndFunc

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Yeah but Id like to count the total amount of messages sent just not the func, theres 4 messages in the func

$count += 4oÝ÷ Ù±ßÛ:¸Ê°j{m¡Ê.ÖµêÞiÈf²®¶­sdgVæ2×6r b33c¶×6rÒb33¶VÆÆòF22×ÖW76vRb33° 6VæBb33c¶×6r b33c¶6÷VçB³Ò 6ÆVW 6VæBb33c¶×6r b33c¶6÷VçB³Ò 6ÆVW 6VæBb33c¶×6r b33c¶6÷VçB³Ò 6ÆVW 6VæBb33c¶×6r b33c¶6÷VçB³Ò 6ÆVW¤VæDgVæ
Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Still getting a error.

Heres what I got.

Func mouse()
JFC()
While 1
    Msg()
        CC()
WEnd
EndFunc

$count = 0

Func Msg()      
$msg = 'Heres my message.{ENTER}'
$1 = 0
While $1 <= 4

Send($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
    sleep(10000)
    Send ($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
    sleep(10000)
    Send($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
    sleep(10000)
    Send ($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
    sleep(10000)

WEnd
EndFunc
Link to comment
Share on other sites

You should post the error you get along with your code, otherwise it's more or less a guessing game for those who are trying to help. My guess is that you are getting an undefined variable error, because you are initializing $count after it's being called in your While loop. If you set $count = 0 before your While loop, it should work.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Global $Count = 0

While 1
    Msg()
Msgbox (0,"","Count is now " & $count)
WEnd


Func Msg()      
$msg = 'Heres my message.{ENTER}'
$1 = 0
While $1 <= 4

;Send($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
   ;sleep(10000)
   ;Send ($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
   ;sleep(10000)
   ;Send($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
   ;sleep(10000)
   ;Heres my message.
;Send ($msg)
    $count += 1
TrayTip("Messages Sent", $count, 5, 1)  
   ;sleep(10000)

$1 +=1
WEnd
EndFunc

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