Sign in to follow this  
Followers 0
Swift

Help With Starting/Stopping A loop

4 posts in this topic

Im tring to keep my bro of myspace...so I made this..its not working though...

#NoTrayIcon
#RequireAdmin
HotKeySet("^!{RSHIFT}", "_Stop")
HotKeySet("^!{SPACE}", "_Go")
HotKeySet("^!{ESC}", "_Exit")
$active = 1
While $active
    ToolTip("Myspace Kill Enabled", 1, 1)
If WinExists("MySpace - Windows Internet Explorer") Then
    WinClose("MySpace - Windows Internet Explorer")
    MsgBox(0, "MySpace", "Myspace Was Disabled By Your Admin")
EndIf
Sleep(500)
WEnd

Func _Stop()
    $active = 0
    ToolTip("", 1, 1)
EndFunc

Func _Go()
    $active = 1
EndFunc

Func _Exit()
    ToolTip("", 1, 1)
    MsgBox(0, "closing", "closing", 1)
    Exit
EndFunc

Any Ideas?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I didn't test this but it should work I think and why did you have "require admin" in your script?

I also recommend you get rid of the message box or they could keep the messagebox open and run a new internet explorer and go to myspace or you could add a timer on the messagebox for 3 seconds and remove the tooltip.

#NoTrayIcon
Global $active 
HotKeySet("^!{RSHIFT}", "_Stop")
HotKeySet("^!{SPACE}", "_Go")
HotKeySet("^!{ESC}", "_Exit")
$active = 0
While 1
    If $active = 1 Then
    If WinExists("MySpace - Windows Internet Explorer") Then
    WinKill("MySpace - Windows Internet Explorer")
    MsgBox(0, "MySpace", "Myspace Was Disabled By Your Admin" , 3)
Else
    Sleep(500)
EndIf
EndIf
Sleep(500)
WEnd

Func _Stop()
    $active = 0
EndFunc

Func _Go()
    $active = 1
EndFunc

Func _Exit()
    MsgBox(0, "", "closing", 1)
    Exit
EndFunc
Edited by JellyFish666

Share this post


Link to post
Share on other sites

Dont know exactly...but I got it too work :) Check it out:

#NoTrayIcon
#RequireAdmin
HotKeySet("^!{SPACE}", "_Stop")
HotKeySet("^{SPACE}", "_Go")
HotKeySet("^!{ESC}", "_Exit")
Global $active = 1
Global $activeoff = 0
Global $activewin = 0
While $active
    ToolTip("Myspace Kill Enabled", 1, 1)
If WinExists("MySpace - Windows Internet Explorer") Then
    WinClose("MySpace - Windows Internet Explorer")
    MsgBox(0, "MySpace", "Myspace Was Disabled By Your Admin")
EndIf
Sleep(100)
WEnd

While $activeoff
Sleep(500)
WEnd

Func _Stop()
    $activeoff = 1
    $activewin = 0
    $active = 0
    ToolTip("", 1, 1)
    ToolTip("Myspace Kill Disabled", 1, 1)
EndFunc

Func _Go()
    $activewin = 1
    $activeoff = 0
    ToolTip("", 1, 1)
    ToolTip("Myspace Kill Enabled", 1, 1)
    While $activewin
        If WinExists("MySpace - Windows Internet Explorer") Then
    WinClose("MySpace - Windows Internet Explorer")
    MsgBox(0, "MySpace", "Myspace Was Disabled By Your Admin")
    EndIf
    WEnd
EndFunc

Func _Exit()
    ToolTip("", 1, 1)
    Exit
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Dont know exactly...but I got it too work :) Check it out:

#NoTrayIcon
#RequireAdmin
HotKeySet("^!{SPACE}", "_Stop")
HotKeySet("^{SPACE}", "_Go")
HotKeySet("^!{ESC}", "_Exit")
Global $active = 1
Global $activeoff = 0
Global $activewin = 0
While $active
    ToolTip("Myspace Kill Enabled", 1, 1)
If WinExists("MySpace - Windows Internet Explorer") Then
    WinClose("MySpace - Windows Internet Explorer")
    MsgBox(0, "MySpace", "Myspace Was Disabled By Your Admin")
EndIf
Sleep(100)
WEnd

While $activeoff
Sleep(500)
WEnd

Func _Stop()
    $activeoff = 1
    $activewin = 0
    $active = 0
    ToolTip("", 1, 1)
    ToolTip("Myspace Kill Disabled", 1, 1)
EndFunc

Func _Go()
    $activewin = 1
    $activeoff = 0
    ToolTip("", 1, 1)
    ToolTip("Myspace Kill Enabled", 1, 1)
    While $activewin
        If WinExists("MySpace - Windows Internet Explorer") Then
    WinClose("MySpace - Windows Internet Explorer")
    MsgBox(0, "MySpace", "Myspace Was Disabled By Your Admin")
    EndIf
    WEnd
EndFunc

Func _Exit()
    ToolTip("", 1, 1)
    Exit
EndFunc
well I did test mine and it seem to work I only had to add and remove a couple things so if you study yours compared to mine that should help you out.

The reason yours didn't work was because you didn't tell the loop was $active was suppose to be set too.

I think also you should use WinKill() instead of WinClose()

Edited by JellyFish666

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