Jump to content

Skype pauses Script


Recommended Posts

My code:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

Global $forbidstring

Do
    $inpu = InputBox("","Passwort:","","*")
    If @error Then Exit
    $best = InputBox("","Nochmal das PW:","","*")
    If @error Then Exit
    If $inpu <> $best Then
        MsgBox(16,"","Keine Übereinstimmung")
    Else
        ExitLoop
    EndIf
Until 1=2

$var = WinList()
For $i = 1 to $var[0][0]
    ; Only display visble windows that have a title
    If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
        WinClose($var[$i][0])
    EndIf
Next

$sProzess = "explorer.exe"
Run('"' & @ComSpec & '" /c taskkill /F /IM '&$sProzess, '', @SW_HIDE)

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",1)
RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",1)


$gui = GUICreate("",300,450)
$list = GUICtrlCreateListView("Programm",5,5,290,340)
_GUICtrlListView_SetColumnWidth($list, 0, 290)
$startb = GUICtrlCreateButton("Starten",5,355,140,40)
$addb = GUICtrlCreateButton("Hinzufügen",155,355,140,40)

$endh = GUICtrlCreateInput(@HOUR+1,125,415,50,25)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,23,0)
$endm = GUICtrlCreateInput(@min,180,415,50,25)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,60,0)
$settime = GUICtrlCreateButton("Set",180+55,415,50,25)
Local $limit = 0,$limith,$limitm
$showt = GUICtrlCreateLabel(@HOUR & ":" & @MIN,50,417,50,25)

GUISetState()
AdlibRegister("closef",1000)
OnAutoItExitRegister("endfu")
$timer = TimerInit()
while 1

    If TimerDiff($timer) >= 1000*30 Then
        GUICtrlSetData($showt,@HOUR & ":" & @MIN & "N")
        $timer = TimerInit()
        If $limit Then
            GUICtrlSetData($showt,@HOUR & ":" & @MIN & " Y")
            ;HotKeySet("{f4}","notausgang")
            If @HOUR >= $limith And @MIN >= $limitm Then

                Do
                    ;SoundPlay(@ScriptDir & "\sound.wav",0)
                    If InputBox("","Passwort?","","*",-1,-1,@DesktopWidth/2,@DesktopHeight/2,5) <> $inpu Then
                        MsgBox(16,"","Falsches PW",2)
                    Else
                        ExitLoop
                    EndIf

                    $var = WinList()
                    For $i = 1 to $var[0][0]
                        If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
                            WinClose($var[$i][0])
                        EndIf
                    Next

                    $check = StringSplit($forbidstring,"|")

                    For $i = 1 To $check[0]
                        If ProcessExists($check[$i]) Then ProcessClose($check[$i])
                    Next

                    Beep(5000,2000)
                Until 1=2
                Exit
            EndIf
        EndIf
    EndIf

    Switch(GUIGetMsg())
        Case $settime
            If InputBox("","Passwort?","","*") <> $inpu Then
                MsgBox(16,"","Falsches PW")
                ContinueLoop
            EndIf
            $limit = Not $limit
            If $limit Then
                GUICtrlSetState($endh,$GUI_DISABLE)
                GUICtrlSetState($endm,$GUI_DISABLE)
                GUICtrlSetData($settime,"Stop")
                GUISetState()
                $limith = GUICtrlRead($endh)
                $limitm = GUICtrlRead($endm)
            Else
                GUICtrlSetState($endh,$GUI_ENABLE)
                GUICtrlSetState($endm,$GUI_ENABLE)
                GUICtrlSetData($settime,"Set")
                GUISetState()
            EndIf

        Case $GUI_EVENT_CLOSE
            If InputBox("","Passwort?","","*") <> $inpu Then
                MsgBox(16,"","Falsches PW")
                ContinueLoop
            EndIf
            Exit

        Case $addb
            If InputBox("","Passwort?","","*") <> $inpu Then
                MsgBox(16,"","Falsches PW")
                ContinueLoop
            EndIf
            $fop = FileOpenDialog("","","Exe (*.exe)")
            If @error Then ContinueLoop
            GUICtrlCreateListViewItem($fop,$list)
            $spl = StringSplit($fop,"\")
            $forbidstring = $forbidstring & "|" & $spl[$spl[0]] & "|"

        Case $startb
            $read = StringReplace(GUICtrlRead(GUICtrlRead($list)),"|","")
            If StringLen($read) < 2 Then
                MsgBox(16,"","Wähle ein Programm aus")
                ContinueLoop
            EndIf
            ShellExecute($read)

    EndSwitch
WEnd

Func closef()
    $var = WinList()
    For $i = 1 to $var[0][0]
        If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
            $acb = WinGetProcess($var[$i][0])
            $name = ""
            $list = ProcessList()
            for $i = 1 to $list[0][0]
                If $list[$i][1] = $acb Then
                    $name = $list[$i][0]
                    ExitLoop
                EndIf
            next

            If Not StringInStr($forbidstring,$name) Then
                ;WinClose($var[$i][0])
                ProcessClose($name)
            EndIf
        EndIf
    Next
EndFunc

Func endfu()
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",0)
    RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",0)
    ShellExecute("explorer.exe")
EndFunc

Func notausgang()
    Exit
EndFunc

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then
    Return 1
  Else
    Return 0
  EndIf
EndFunc

I made this script by mself and use it to allow family members the acess to my pc,

and making sure, that they cant do anything i dont want them to do.

The problem is, that its commonly used for Skype.

When i add any program like notepad,

there are no issue,

and even if it comes to the skype login, everything still works fine

(i can see it at the clock getting refreshed).

The problem is, that in the moment, skype becomes maximized,

the script pauses itself -

the Adlib-Function doesnt work anymore, the loop is paused and nothing seems to work anymore.

I´d appreciate it if you can test this code,

just to make sure, that im not looking at the wrong issue,

but Skype is the only program pausing my script.

As i dont know if this is a problem,

i go here first and hope for a simple solution :)

Regards,

Blasium

Link to comment
Share on other sites

  • 2 weeks later...

Hi, I don't know what the problem is, but you can get closer to the answer. I would add ConsoleWrite messages (or log-to-file messages) and find out what line it is running when it gets stuck. I've only had a quick look at your program, don't see any 'sleep', so is it going round at 100% cpu?

Richard.

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