Jump to content

What will cause this? <Hot picture inside>


au3scr
 Share

Recommended Posts

When i execute program , there are no errors, warnings, it rus some amount of time and then it just stops with out any error messages.

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\ra.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>01:37:21 Starting AutoIt3Wrapper v.1.10.1.12 Environment(Language:0409 Keyboard:00000425 OS:WIN_XP/Service Pack 2 CPU:X86 ANSI)

>Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3

+>01:37:21 AU3Check ended.rc:0

>Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "Z:\ra.au3"

Z:\ra.au3 (344) : ==> Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.:

_FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")

->01:38:18 AutoIT3.exe ended.rc:1

+>01:38:19 AutoIt3Wrapper Finished

>Exit code: 1 Time: 58.414

AutoIt will quit to prevent stack overflow. <<<----- I dont understand meaning of this,and how to avoid this.

Do i need configure compiler? scite? use any opt commands or what i need to do?

For those people who want see source:

#include <File.au3>

FileDelete (@ScriptDir & "\ar.log")
_FileWriteLog(@ScriptDir & "\ar.log", "ApplicationsRestricter Started (Author:Rain)")

$CountTimes = 19
$INILocation = @TempDir & "\KillApp.ini"

$IsLocal = IniRead(@TempDir & "\KillApp.ini", "General", "Local", "ERROR")
If $IsLocal = "ERROR" Then
    $INILocation = @ScriptDir & "\KillApp.ini"
EndIf   
    
    
If Not FileExists(@TempDir & "\KillApp.ini") Then
    $INILocation = @ScriptDir & "\KillApp.ini"
EndIf
_FileWriteLog(@ScriptDir & "\ar.log", "[PRE-DEFINE-VARIABLE] Ini file path: "&$INILocation)

$IsAnyLimits = IniRead($INILocation, "General", "IsLimited", "ERROR")
$IsLocal = IniRead($INILocation, "General", "Local", "ERROR")
$Refresh = IniRead($INILocation, "General", "RefreshTime", "ERROR")
$LimitedProcessListFile = IniRead($INILocation, "General", "ProcessListFile", "ERROR")
$INIfileLocation = IniRead($INILocation, "General", "INILocation", "ERROR")
$IsAllowedOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnMonday", "ERROR")
$SinceallowedHourOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnMonday", "ERROR")
$SinceallowedminutesOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnMonday", "ERROR")
$IsAllowedOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnTuesday", "ERROR")
$SinceallowedHourOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnTuesday", "ERROR")
$SinceallowedminutesOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnTuesday", "ERROR")
$IsAllowedOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnWednesday", "ERROR")
$SinceallowedHourOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnWednesday", "ERROR")
$SinceallowedminutesOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnWednesday", "ERROR")
$IsAllowedOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnThursday", "ERROR")
$SinceallowedHourOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnThursday", "ERROR")
$SinceallowedminutesOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnThursday", "ERROR")
$IsAllowedOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnFriday", "ERROR")
$SinceallowedHourOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnFriday", "ERROR")
$SinceallowedminutesOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnFriday", "ERROR")
$IsAllowedOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnSaturday", "ERROR")
$SinceallowedHourOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnSaturday", "ERROR")
$SinceallowedminutesOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnSaturday", "ERROR")
$IsAllowedOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnSunday", "ERROR")
$SinceallowedHourOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnSunday", "ERROR")
$SinceallowedminutesOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnSunday", "ERROR")
$CurrentHour = @HOUR
$CurrentMinutes = @MIN
$currentWeekday = @WDAY - 1
_FileWriteLog(@ScriptDir & "\ar.log", "[PRE-DEFINE-VARIABLE]Refresh and sleep time:" & $Refresh)
_FileWriteLog(@ScriptDir & "\ar.log", "[PRE-DEFINE-VARIABLE]islocal state:" & $IsLocal)
;~ If $IsLocal = 1 Then
;~  LocalINIRead()
;~  _FileWriteLog(@ScriptDir & "\ar.log", "[PRE-DEFINE-VARIABLE]Islocal value LOCAL" & $IsLocal)
;~ EndIf
;~ If $IsLocal = 0 Then
;~  ReadINI()
;~  _FileWriteLog(@ScriptDir & "\ar.log", "[PRE-DEFINE-VARIABLE]Islocal value NETWORK" & $IsLocal)
;~ EndIf
LocalCheck()

Func ReadINI()
    $INILocation = @TempDir & "\KillApp.ini"
    If Not FileExists(@TempDir & "\KillApp.ini") Then
        $INILocation = @ScriptDir & "\KillApp.ini"
    EndIf
    $IsAnyLimits = IniRead($INILocation, "General", "IsLimited", "ERROR")
    $IsLocal = IniRead($INILocation, "General", "Local", "ERROR")
    $Refresh = IniRead($INILocation, "General", "RefreshTime", "ERROR")
    $INIfileLocation = IniRead($INILocation, "General", "INILocation", "ERROR")
    $LimitedProcessListFile = IniRead($INILocation, "General", "ProcessListFile", "ERROR")
    ;mon
    $IsAllowedOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnMonday", "ERROR")
    $SinceallowedHourOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnMonday", "ERROR")
    $SinceallowedminutesOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnMonday", "ERROR")
    ;tue
    $IsAllowedOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnTuesday", "ERROR")
    $SinceallowedHourOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnTuesday", "ERROR")
    $SinceallowedminutesOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnTuesday", "ERROR")
    ;Wed
    $IsAllowedOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnWednesday", "ERROR")
    $SinceallowedHourOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnWednesday", "ERROR")
    $SinceallowedminutesOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnWednesday", "ERROR")
    ;Thu
    $IsAllowedOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnThursday", "ERROR")
    $SinceallowedHourOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnThursday", "ERROR")
    $SinceallowedminutesOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnThursday", "ERROR")
    ;fri
    $IsAllowedOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnFriday", "ERROR")
    $SinceallowedHourOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnFriday", "ERROR")
    $SinceallowedminutesOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnFriday", "ERROR")
    ;sat
    $IsAllowedOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnSaturday", "ERROR")
    $SinceallowedHourOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnSaturday", "ERROR")
    $SinceallowedminutesOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnSaturday", "ERROR")
    ;Sun
    $IsAllowedOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnSunday", "ERROR")
    $SinceallowedHourOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnSunday", "ERROR")
    $SinceallowedminutesOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnSunday", "ERROR")
    _FileWriteLog(@ScriptDir & "\ar.log", "[NETWORK-DEFINE-VARIABLE]Mode:Network")
    _FileWriteLog(@ScriptDir & "\ar.log", "[NETWORK-DEFINE-VARIABLE]Refresh and sleep Net time:" & $Refresh)
    _FileWriteLog(@ScriptDir & "\ar.log", "[NETWORK-DEFINE-VARIABLE]islocal state Net:" & $IsLocal)
EndFunc   ;==>ReadINI
;will read inifile if using local mode
Func LocalINIRead()
    $INILocation = @ScriptDir & "\KillApp.ini"
    _FileWriteLog(@ScriptDir & "\ar.log", "local ini location" & $INILocation)
    $IsAnyLimits = IniRead($INILocation, "General", "IsLimited", "ERROR")
    $IsLocal = IniRead($INILocation, "General", "Local", "ERROR")
    $Refresh = IniRead($INILocation, "General", "RefreshTime", "ERROR")
    $INIfileLocation = IniRead($INILocation, "General", "INILocation", "ERROR")
    $LimitedProcessListFile = IniRead($INILocation, "General", "ProcessListFile", "ERROR")
    ;mon
    $IsAllowedOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnMonday", "ERROR")
    $SinceallowedHourOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnMonday", "ERROR")
    $SinceallowedminutesOnMonday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnMonday", "ERROR")
    ;tue
    $IsAllowedOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnTuesday", "ERROR")
    $SinceallowedHourOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnTuesday", "ERROR")
    $SinceallowedminutesOnTuesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnTuesday", "ERROR")
    ;Wed
    $IsAllowedOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnWednesday", "ERROR")
    $SinceallowedHourOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnWednesday", "ERROR")
    $SinceallowedminutesOnWednesday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnWednesday", "ERROR")
    ;Thu
    $IsAllowedOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnThursday", "ERROR")
    $SinceallowedHourOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnThursday", "ERROR")
    $SinceallowedminutesOnThursday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnThursday", "ERROR")
    ;fri
    $IsAllowedOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnFriday", "ERROR")
    $SinceallowedHourOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnFriday", "ERROR")
    $SinceallowedminutesOnFriday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnFriday", "ERROR")
    ;sat
    $IsAllowedOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnSaturday", "ERROR")
    $SinceallowedHourOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnSaturday", "ERROR")
    $SinceallowedminutesOnSaturday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnSaturday", "ERROR")
    ;Sun
    $IsAllowedOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowOnSunday", "ERROR")
    $SinceallowedHourOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourOnSunday", "ERROR")
    $SinceallowedminutesOnSunday = IniRead($INILocation, "WhenIsAlowedToUse", "AllowUseAfterHourMinOnSunday", "ERROR")
    _FileWriteLog(@ScriptDir & "\ar.log", "[LOCAL-DEFINE-VARIABLE]Refresh and sleep time:" & $Refresh)
    _FileWriteLog(@ScriptDir & "\ar.log", "[LOCAL-DEFINE-VARIABLE] variable islocal state:" & $IsLocal)
    _FileWriteLog(@ScriptDir & "\ar.log", "[LOCAL-DEFINE-VARIABLE] Mode:local")
EndFunc   ;==>LocalINIRead

Func GetDayAndTimeInfoAndDoRigtFunction()
    Sleep($Refresh)
    $CountTimes = $CountTimes + 1
    $CurrentHour = @HOUR
    $CurrentMinutes = @MIN
    $currentWeekday = @WDAY - 1
    If $CountTimes = 20 Then
        $CountTimes = 0
        _FileWriteLog(@ScriptDir & "\ar.log", "Update configuration")
        UpdateSettings()
    EndIf
    If $IsAnyLimits = "False" Then
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf

    If $currentWeekday = 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Monday")
        RestrictMonday()
    EndIf
    If $currentWeekday = 2 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Tuesday")
        RestrictTuesday()
    EndIf
    If $currentWeekday = 3 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Wednesday")
        RestrictWednesday()
    EndIf
    If $currentWeekday = 4 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Thursday")
        RestrictThursday()
    EndIf
    If $currentWeekday = 5 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Friday")
        RestrictFriday()
    EndIf
    If $currentWeekday = 6 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Saturday")
        RestrictSaturday()
    EndIf
    If $currentWeekday = 0 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is: Sunday")
        RestrictSunday()
    EndIf
EndFunc   ;==>GetDayAndTimeInfoAndDoRigtFunction

;MONDAY Block Start =============>
Func RestrictMonday()
    If $IsAllowedOnMonday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is everyting and in every time allowed")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf

    If $IsAllowedOnMonday = "NO" And $CurrentHour < $SinceallowedHourOnMonday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnMonday = "NO" And $CurrentHour >= $SinceallowedHourOnMonday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesMonday()
    EndIf
    
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictMonday

Func CheckMinutesMonday()
    $morehours = $CurrentHour - $SinceallowedHourOnMonday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnMonday And $CurrentMinutes >= $SinceallowedminutesOnMonday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnMonday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesMonday

;TUESDAY Block Start =============>
Func RestrictTuesday()
    If $IsAllowedOnTuesday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need wait some minutes")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $IsAllowedOnTuesday = "NO" And $CurrentHour < $SinceallowedHourOnTuesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnTuesday = "NO" And $CurrentHour >= $SinceallowedHourOnTuesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesTuesday()
    EndIf
    
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictTuesday

Func CheckMinutesTuesday()
    $morehours = $CurrentHour - $SinceallowedHourOnTuesday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnTuesday And $CurrentMinutes >= $SinceallowedminutesOnTuesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnTuesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesTuesday

;WEDNESDAY Block Start =============>
Func RestrictWednesday()
    If $IsAllowedOnWednesday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is everyting and in every time allowed")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $IsAllowedOnWednesday = "NO" And $CurrentHour < $SinceallowedHourOnWednesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnWednesday = "NO" And $CurrentHour >= $SinceallowedHourOnWednesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesWednesday()
    EndIf
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictWednesday

Func CheckMinutesWednesday()
    $morehours = $CurrentHour - $SinceallowedHourOnWednesday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnWednesday And $CurrentMinutes >= $SinceallowedminutesOnWednesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnWednesday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesWednesday
;THURSDAY Block Start =============>
Func RestrictThursday()
    If $IsAllowedOnThursday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is everyting and in every time allowed")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $IsAllowedOnThursday = "NO" And $CurrentHour < $SinceallowedHourOnThursday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnThursday = "NO" And $CurrentHour >= $SinceallowedHourOnThursday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesThursday()
    EndIf
    
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictThursday

Func CheckMinutesThursday()
    $morehours = $CurrentHour - $SinceallowedHourOnThursday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnThursday And $CurrentMinutes >= $SinceallowedminutesOnThursday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnThursday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesThursday
;FRIDAY Block Start =============>
Func RestrictFriday()
    If $IsAllowedOnFriday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is everyting and in every time allowed")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $IsAllowedOnFriday = "NO" And $CurrentHour < $SinceallowedHourOnFriday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnFriday = "NO" And $CurrentHour >= $SinceallowedHourOnFriday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesFriday()
    EndIf
    
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictFriday

Func CheckMinutesFriday()
    $morehours = $CurrentHour - $SinceallowedHourOnFriday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnFriday And $CurrentMinutes >= $SinceallowedminutesOnFriday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnFriday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesFriday

;SATURDAY Block Start =============>
Func RestrictSaturday()
    If $IsAllowedOnSaturday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is everyting and in every time allowed")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $IsAllowedOnSaturday = "NO" And $CurrentHour < $SinceallowedHourOnSaturday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnSaturday = "NO" And $CurrentHour >= $SinceallowedHourOnSaturday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesSaturday()
    EndIf
    
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictSaturday

Func CheckMinutesSaturday()
    $morehours = $CurrentHour - $SinceallowedHourOnSaturday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnSaturday And $CurrentMinutes >= $SinceallowedminutesOnSaturday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnSaturday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesSaturday

;SUNDAY Block Start =============>
Func RestrictSunday()
    If $IsAllowedOnSunday = "YES" Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Today is everyting and in every time allowed")
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $IsAllowedOnSunday = "NO" And $CurrentHour < $SinceallowedHourOnSunday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "decided to kill cuz of hour")
        DisAllowApp()
    EndIf
    If $IsAllowedOnSunday = "NO" And $CurrentHour >= $SinceallowedHourOnSunday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Hours are ok, lests ses if there are any problems with Minutes")
        CheckMinutesSunday()
    EndIf
    
    Sleep($Refresh)
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>RestrictSunday

Func CheckMinutesSunday()
    $morehours = $CurrentHour - $SinceallowedHourOnSunday
    If $morehours >= 1 Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Everything is ok (allowed to execute)")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentHour >= $SinceallowedHourOnSunday And $CurrentMinutes >= $SinceallowedminutesOnSunday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "Minutes and hours both are ok, application is allowed")
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf
    If $CurrentMinutes < $SinceallowedminutesOnSunday Then
        _FileWriteLog(@ScriptDir & "\ar.log", "We need to wait some minutes")
        DisAllowApp()
    EndIf
EndFunc   ;==>CheckMinutesSunday


Func DisAllowApp()
    Sleep($Refresh)
    $LocalKillFile = @ScriptDir & "\KillList.txt"
    If $IsLocal = 0 Then
        $LocalKillFile = @TempDir & "\KillList.txt"
    EndIf
    If $IsLocal = 1 Then
        $LocalKillFile = @ScriptDir & "\KillList.txt"
    EndIf
    If Not FileExists (@TempDir & "\KillList.txt") Then
        $LocalKillFile = @ScriptDir & "\KillList.txt"
    EndIf
    If Not FileExists (@ScriptDir & "\KillList.txt") Then
        $LocalKillFile =  @TempDir& "\KillList.txt"
    EndIf
    If Not FileExists($LocalKillFile) Then
        _FileWriteLog(@ScriptDir & "\ar.log", "I Cant find List of applications that i must kill,I will try download it")
        GetKillList()
    EndIf
    _FileWriteLog(@ScriptDir & "\ar.log", "I Will kill unwanted running applications now...")
    $ApplicationsToKillCount = _FileCountLines($LocalKillFile)
    _FileWriteLog(@ScriptDir & "\ar.log", "Kill list Location:"&$LocalKillFile)
    _FileWriteLog(@ScriptDir & "\ar.log", "Applications to kill:" & $ApplicationsToKillCount)
    $CurrentKillLine = 0
    For $i = 1 To $ApplicationsToKillCount
        $CurrentKillLine = $CurrentKillLine + 1
        $process = FileReadLine($LocalKillFile, $CurrentKillLine)
        _FileWriteLog(@ScriptDir & "\ar.log", "Killing:" & $process)
        WinKill($process)
    Next
    GetDayAndTimeInfoAndDoRigtFunction()
EndFunc   ;==>DisAllowApp

Func GetKillList()
        _FileWriteLog(@ScriptDir & "\ar.log", "Downloading KillList file from: "&$LimitedProcessListFile)
        InetGet($LimitedProcessListFile, @TempDir & "\KillList.txt",1,0)
        _FileWriteLog(@ScriptDir & "\ar.log", "Saved KillList file to: "& @TempDir & "\KillList.txt")
EndFunc   ;==>GetKillList

Func GetINIFile()
        _FileWriteLog(@ScriptDir & "\ar.log", "Downloading ini file from: "&$INIfileLocation)
        InetGet($INIfileLocation, @TempDir & "\KillApp.ini",1,0)
        _FileWriteLog(@ScriptDir & "\ar.log", "Saved ini file to: "& @TempDir & "\KillApp.ini")
EndFunc   ;==>GetINIFile

Func LocalCheck()
    If FileExists(@TempDir & "\KillApp.ini") Then
    $IsLocal = IniRead(@TempDir & "\KillApp.ini", "General", "Local", "ERROR")
        If $IsLocal = 1 Then
            _FileWriteLog(@ScriptDir & "\ar.log", "Mode::[Local("&$IsLocal&")]")
            LocalINIRead()
            GetDayAndTimeInfoAndDoRigtFunction()
        Else
            _FileWriteLog(@ScriptDir & "\ar.log", "Mode::[Network("&$IsLocal&")]")
            ReadINI()
            GetDayAndTimeInfoAndDoRigtFunction()
        EndIf   
    EndIf
    If FileExists(@ScriptDir & "\KillApp.ini") Then
    $IsLocal = IniRead(@ScriptDir & "\KillApp.ini", "General", "Local", "ERROR")
        If $IsLocal = 1 Then
            _FileWriteLog(@ScriptDir & "\ar.log", "Mode::[Local("&$IsLocal&")]")
            LocalINIRead()
            GetDayAndTimeInfoAndDoRigtFunction()
        Else
            _FileWriteLog(@ScriptDir & "\ar.log", "Mode::[Network("&$IsLocal&")]")
            ReadINI()
            GetDayAndTimeInfoAndDoRigtFunction()
        EndIf   
    EndIf
EndFunc   ;==>LocalCheck
    
Func UpdateSettings()
    If $IsLocal = 1 Then
        $CountTimes = 0
        _FileWriteLog(@ScriptDir & "\ar.log", "Mode: Local ==> Data Reloaded")
        LocalINIRead()
        GetDayAndTimeInfoAndDoRigtFunction()
    Else
        $CountTimes = 0
        _FileWriteLog(@ScriptDir & "\ar.log", "Mode: Network ==> Data will be downloaded and then reloaded")
        GetINIFile()
        GetKillList()
        ReadINI()
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf   
EndFunc   ;==>UpdateSettings

And the picture that we all hate.

post-27656-1225412026_thumb.png

Edited by au3scr
Link to comment
Share on other sites

I can make several suggestions:

Your doing LOTs of INIreads. Use INIreadSection and use the returned array instead.

Many of your day functions simply repeat themselves and the only difference is the day. Make an array to cover the days and use that to consolidate your functions. This will make your code much cleaner, and also would make it easier to troubleshoot.

Link to comment
Share on other sites

When i execute program , there are no errors, warnings, it rus some amount of time and then it just stops with out any error messages.

AutoIt will quit to prevent stack overflow. <<<----- I dont understand meaning of this,and how to avoid this.

Do i need configure compiler? scite? use any opt commands or what i need to do?

Why does this function call itself?

Func GetDayAndTimeInfoAndDoRigtFunction()

   ; <snip>

    If $IsAnyLimits = "False" Then
        Sleep($Refresh)
        GetDayAndTimeInfoAndDoRigtFunction()
    EndIf

   ; <snip>

EndFunc  ;==>GetDayAndTimeInfoAndDoRigtFunction
This is surely where your recursion error is coming from.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...