Sign in to follow this  
Followers 0
Dethredic

Basic Function Help

11 posts in this topic

Heres my script

Dim $10Mins = 600000
Global $Timeup

Call("Countdown")

Call("Timeup")


;Countdown 10 Mins

Func Countdown()
    If WinExists("Windows Live Messenger") Then
        MsgBox( , "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
        Do
            $10Mins - 1000 Sleep(1000)
        Until $10Mins = 0
    IniWrite( "Log.ini", @MON , @MDAY , "Timeup")
    EndIf
EndFunc


;Kill MSN

Func Timeup()
    $Timeup = IniRead( "Log.ini", @MON , @MDAY , "NotFound")
    If WinExists("Windows Live Messenger") Then 
        If $Timeup = "Timeup" Then
            WinKill("Windows Live Messenger")
            MsgBox(, "Times Up", "Your 10 Minutes Has Expired, Try Again Tomorrow")
        EndIf
    EndIf
EndFunc

It is suposed to count down 10 mins then kill msn

it will keep killing it everytime it is opened

i run it and it doesn't work how can i fix this

i thought of useing adlib but im not sure if it would work well in this situation or not

thanks


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites



maybe...

Dim $10Mins = 600000
Global $Timeup

Call("Countdown")

Call("Timeup")


;Countdown 10 Mins

Func Countdown()
    If WinExists("Windows Live Messenger") Then
        MsgBox( 0, "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
        Do
            Sleep(1000)
            $10Mins = $10Mins - 1000 
        Until $10Mins = 0
    IniWrite( "Log.ini", @MON , @MDAY , "Timeup")
    EndIf
EndFunc


;Kill MSN

Func Timeup()
    $Timeup = IniRead( "Log.ini", @MON , @MDAY , "NotFound")
    If WinExists("Windows Live Messenger") Then 
        If $Timeup = "Timeup" Then
            WinKill("Windows Live Messenger")
            MsgBox(0, "Times Up", "Your 10 Minutes Has Expired, Try Again Tomorrow")
        EndIf
    EndIf
EndFunc

not tested

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

lol it works

tks


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

why not just

MsgBox( 0, "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
Sleep (600000)
While 1
    If WinExists ("Windows Live Messenger") Then WinKill ("Windows Live Messenger")
Sleep (1000)
WEnd

not tested...

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

why not just

MsgBox( 0, "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
Sleep (600000)
While 1
    If WinExists ("Windows Live Messenger") Then WinKill ("Windows Live Messenger")
Sleep (1000)
WEnd

not tested...

because i want to make it so that if msn quits the countdown will stop.

thats y i was thinking of useing adlib


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

Valuater

ur script worked last night but now it doesn't

wierd


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

because i want to make it so that if msn quits the countdown will stop.

thats y i was thinking of useing adlib

but as far as i can see, that script will not stop counting down if msn quits. it will not start if it doesn't exist, but if msn is exited during the countdown, it will still continue to count down.

$time_left = 600000
MsgBox( 0, "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
Do
    If WinExists ("Windows Live Messenger") Then
        $time_left -= 1000
        Sleep (1000)
    EndIf
Until $time_left = 0
While 1
    If WinExists ("Windows Live Messenger") Then WinKill ("Windows Live Messenger")
    Sleep (1000)
WEnd

That way, the count down will not continue counting unless live messenger exists, and it will continue to kill it after time is up. And, no seperate INI files in there, and no unneccessay Call ( )'s

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

You could try if this helps

Global $10Mins = 600000
Global $Timeup

Countdown()

Timeup()


;Countdown 10 Mins

Func Countdown()
    If WinExists("Windows Live Messenger") Then
        MsgBox( 0, "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
        While WinExists("Windows Live Messenger")
            Switch $10Mins
                Case 0
                    ExitLoop
                Case Else
                    $10Mins -= 1000
                    Sleep(1000)
            EndSwitch
        WEnd
        IniWrite( "Log.ini", @MON , @MDAY , "Timeup")
    EndIf
EndFunc


;Kill MSN

Func Timeup()
    $Timeup = IniRead( "Log.ini", @MON , @MDAY , "NotFound")
    If WinExists("Windows Live Messenger") Then 
        If $Timeup = "Timeup" And $10Mins = 0 Then
            WinKill("Windows Live Messenger")
            MsgBox(0, "Times Up", "Your 10 Minutes Has Expired, Try Again Tomorrow")
        EndIf
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

thanks guys but i figured it out on my own

Dim $10Mins = 600000
Global $Timeup

While 1 
If ProcessExists("msnmsgr.exe") Then 
     Call("Timeup")
     Call("Countdown")
EndIf
Sleep(1000)
WEnd

Call("Timeup")


;Countdown 10 Mins

Func Countdown()
    If ProcessExists("msnmsgr.exe") Then
        Sleep(2000)
        MsgBox(4096 , "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
        Do
            If ProcessExists("msnmsgr.exe") Then
            Sleep(1000)
            $10Mins = $10Mins - 1000
            EndIf
        Until $10Mins = 0
    IniWrite( "Log.ini", @MON , @MDAY , "Timeup")
    EndIf
EndFunc


;Kill MSN

Func Timeup()
    $Timeup = IniRead( "Log.ini", @MON , @MDAY , "NotFound")
    If ProcessExists("msnmsgr.exe") Then    
        If $Timeup = "Timeup" Then
            WinKill("msnmsgr.exe")
            MsgBox(4096 , "Times Up", "Your 10 Minutes Has Expired, Try Again Tomorrow")
        EndIf
    EndIf
EndFunc

"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

one more suggestion. Don't use Call ("Timeup") or Call ("Countdown"). Just use

Timeup ( )
CountDown ( )

unnecessary use of the Call ( ) command is bad practice. :)


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

lol

i doesn't matter casue it does exactly wat i want it to do

thanks for the help guyus


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

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