Что нового

Children Control

Fever

Скриптер
Сообщения
308
Репутация
112
AutoIt: 3.3.6.0
Версия: 1.0
Категория: Разное
Название: Children Control
Описание: Программа специально для регулирования использования компьютера вашими младшими братьями\сестрами :smile: :IL_AutoIt_1:
Код:
Код:
#NoTrayIcon
#Include <Misc.au3>
#include <WindowsConstants.au3>
#include <TabConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#Include <File.au3>

Global $PROGNAME = 'Children Control'
Global $PROGVER = '1.0'
Global $PROGAUTHOR = 'Fever'
Global $PROGTITLE = $PROGNAME & ' v' & $PROGVER

If _Singleton($PROGTITLE, 1) = 0 Then
	MsgBox(64, 'Error!', 'This program is already running.')
	Exit
EndIf

Global $TIME = 0
Global $bStart, $bTimeSet, $bModeSet, $bHotSet, $bHotNone, $bHotYes, $bTipSet, $sTime, $sMode, $sHot1, $sHot2, $sHot3, $sHot4, $sTip, $cTime, $cMode, $cHot, $cTip, $plus1, $plus2, $plus3, $plusLabe
Global $MODE = 'Shutdown'
Global $HOT = '^1'
Global $HOTc = 'Ctrl + 1'
Global $TIP = 'None'

HotKeySet($HOT, 'Close')

$gui = GUICreate($PROGTITLE,300,200)

$t = GUICtrlCreateTab(0,0,300,200,$TCS_HOTTRACK)
$tControl = GUICtrlCreateTabItem('Control')
Control()
$tSetting = GUICtrlCreateTabItem('Setting')
Setting()
$tAbout = GUICtrlCreateTabItem('About')
About()

GUISetState()
TraySetState()

Msg()

Func Msg()
While True
	Switch GUIGetMsg()
		Case -3
			Close()
		Case $bStart
			If $TIME = 0 Then
				MsgBox(64, 'Alert', 'Time is not entered!')
			Else
				GUISetState(@SW_HIDE)
				$TIME = $TIME * 60
				MsgBox(64, 'Alert', 'Time to past: ' & Round($hTime, 2) & ' hour(s)')
				For $i = 0 To $TIME - 60 Step 1
					If WinExists('Диспетчер задач Windows') Then WinClose('Диспетчер задач Windows')
					Sleep(1000)
					TrayTip('', $i, 10)
				Next
				TrayTip('', 'One minute left!', 10)
				For $i = 0 To 60 Step 1
					If WinExists('Диспетчер задач Windows') Then WinClose('Диспетчер задач Windows')
					Sleep(1000)
				Next
				If $MODE = 'Shutdown' Then
					Shutdown(1)
					Close()
				Else
					Shutdown(0)
					Close()
				EndIf
			EndIf
		Case $bTimeSet
			$TIME = GUICtrlRead($sTime)
			$hTIME = $TIME/60
			If Not StringIsDigit($TIME) Then
				$TIME = 0
				MsgBox(64, 'Alert', 'You entered incorrect time!')
			ElseIf $TIME < 5 Then
				$TIME = 0
				MsgBox(64, 'Alert', 'The minimize importance of time is 5!')
			Else
				GUICtrlSetData($cTime, $TIME & ' = ' & Round($hTime, 2) & ' hour(s)')
			EndIf
		Case $bModeSet
			$MODE = GUICtrlRead($sMode)
			GUICtrlSetData($cMode, $MODE)
		Case $bHotNone
			$HOT = ''
			$HOTc = 'None'
			GUICtrlSetData($cHot, $Hotc)
			GUICtrlSetState($sHot1, $GUI_DISABLE)
			GUICtrlSetState($sHot2, $GUI_DISABLE)
			GUICtrlSetState($sHot3, $GUI_DISABLE)
			GUICtrlSetState($sHot4, $GUI_DISABLE)
			GUICtrlSetState($plus1, $GUI_DISABLE)
			GUICtrlSetState($plus2, $GUI_DISABLE)
			GUICtrlSetState($plus3, $GUI_DISABLE)
			GUICtrlSetState($plusLabe, $GUI_DISABLE)
			GUICtrlSetState($bHotSet, $GUI_DISABLE)
			GUICtrlSetState($bHotYes, $GUI_ENABLE)
		Case $bHotYes
			$HOT = '^1'
			$HOTc = 'Ctrl + 1'
			GUICtrlSetData($cHot, $Hotc)
			GUICtrlSetState($sHot1, $GUI_ENABLE)
			GUICtrlSetState($sHot2, $GUI_ENABLE)
			GUICtrlSetState($sHot3, $GUI_ENABLE)
			GUICtrlSetState($sHot4, $GUI_ENABLE)
			GUICtrlSetState($plus1, $GUI_ENABLE)
			GUICtrlSetState($plus2, $GUI_ENABLE)
			GUICtrlSetState($plus3, $GUI_ENABLE)
			GUICtrlSetState($plusLabe, $GUI_ENABLE)
			GUICtrlSetState($bHotSet, $GUI_ENABLE)
			GUICtrlSetState($bHotYes, $GUI_DISABLE)
		Case $bHotSet
			If GUICtrlRead($sHot1) = $GUI_CHECKED Then
				$h1 = '+'
			Else
				$h1 = ''
			EndIf
			If GUICtrlRead($sHot2) = $GUI_CHECKED Then
				$h2 = '^'
			Else
				$h2 = ''
			EndIf
			If GUICtrlRead($sHot3) = $GUI_CHECKED Then
				$h3 = '!'
			Else
				$h3 = ''
			EndIf
			$h4 = GUICtrlRead($sHot4)
				$HOT = $h1 & $h2 & $h3 & $h4
				HotKeySet($HOT, 'Close')
				$HOTc1 = StringReplace($h1, '+', 'Shift + ')
				$HOTc2 = StringReplace($h2, '^', 'Ctrl + ')
				$HOTc3 = StringReplace($h3, '!', 'Alt + ')
				$HOTc = $HOTc1 & $HOTc2 & $HOTc3 & $h4
			GUICtrlSetData($cHot, $Hotc)
		Case $bTipSet
			$TIP = GUICtrlRead($sTip)
			$TIPc = $TIP
			If $TIP = '' Then $TIPc = 'None'
			GUICtrlSetData($cTip, $TIPc)
		EndSwitch
WEnd
EndFunc
;---

Func Control()
	GUICtrlCreateLabel('Time to pass (minutes):', 10, 30, -1, 20)
	$cTime = GUICtrlCreateLabel($TIME, 150, 30, 100, 20)
	GUICtrlCreateLabel('When time is out:', 10, 50, -1, 20)
	$cMode = GUICtrlCreateLabel($MODE, 150, 50, 100, 20)
	GUICtrlCreateLabel('HotKey to stop:', 10, 70, -1, 20)
	$cHot = GUICtrlCreateLabel($HOTc, 150, 70, 120, 20)
	GUICtrlCreateLabel('Tip:', 10, 90, -1, 20)
	$cTip = GUICtrlCreateLabel($TIP, 150, 90, 120, 20)
	$bStart = GUICtrlCreateButton('Start', 10, 130, 280, 60)
	GUICtrlSetFont($cMode, 8, 800, 0, 'Tahoma')
	GUICtrlSetFont($cTime, 8, 800, 0, 'Tahoma')
	GUICtrlSetFont($cHot, 8, 800, 0, 'Tahoma')
	GUICtrlSetFont($cTip, 8, 800, 0, 'Tahoma')
EndFunc
;---
Func Setting()
	GUICtrlCreateLabel('Time before start (minutes):', 10, 33, -1, 20)
	$sTime = GUICtrlCreateInput('', 170, 30, 50, 20)
	GUICtrlSetLimit($sTime, 4)
	$bTimeSet = GUICtrlCreateButton('Set',230, 30, 60, 20)
	GUICtrlCreateLabel('', 10, 55, 280, 0, $SS_ETCHEDHORZ)
	GUICtrlCreateLabel('Select mode:', 10, 68, -1, 20)
	$sMode = GUICtrlCreateCombo('Shutdown', 80, 65, 100, 20)
	GUICtrlSetData(-1, 'Block channel')
	$bModeSet = GUICtrlCreateButton('Set',230, 65, 60, 20)
	GUICtrlCreateLabel('', 10, 90, 280, 0, $SS_ETCHEDHORZ)
	$plusLabe = GUICtrlCreateLabel('HotKey to stop:', 10, 103, -1, 20)
	$sHot1 = GUICtrlCreateCheckbox('Shift', 90, 100, 40, 20)
	$plus1 = GUICtrlCreateLabel('+', 135, 103, -1, 20)
	$sHot2 = GUICtrlCreateCheckbox('Ctrl', 150, 100, 40, 20)
	$plus2 = GUICtrlCreateLabel('+', 190, 103, -1, 20)
	$sHot3 = GUICtrlCreateCheckbox('Alt', 205, 100, 30, 20)
	$plus3 = GUICtrlCreateLabel('+', 240, 103, -1, 20)
	$sHot4 = GUICtrlCreateCombo('1', 260, 100, 30, 20)
	GUICtrlSetData(-1, '2|3|4|5|6|7|8|9|0')
	$bHotSet = GUICtrlCreateButton('Set', 10, 120, 60, 20)
	$bHotNone = GUICtrlCreateButton('None', 80, 120, 60, 20)
	$bHotYes = GUICtrlCreateButton('Set on', 150, 120, 60, 20)
	GUICtrlSetState($bHotYes, $GUI_DISABLE)
	GUICtrlCreateLabel('', 10, 150, 280, 0, $SS_ETCHEDHORZ)
	GUICtrlCreateLabel('Tip:', 10, 163, -1, 20)
	$sTip = GUICtrlCreateInput('', 40, 160, 180, 20)
	$bTipSet = GUICtrlCreateButton('Set',230, 160, 60, 20)
EndFunc
;---
Func About()
	GUICtrlCreateLabel($PROGNAME, 10, 30, 280, 20, $SS_CENTER)
	GUICtrlSetFont(-1, 8.5, 800, 0, 'Tahoma')
	GUICtrlCreateLabel('(version ' & $PROGVER & ')', 10, 45, 280, 20, $SS_CENTER)
	GUICtrlCreateLabel('Contact me:', 10, 65, 280, 20)
	GUICtrlCreateLabel('ICQ: 363-204-476', 10, 85, 280, 20)
	GUICtrlSetFont(-1, 8.5, 800, 0, 'Tahoma')
	GUICtrlCreateLabel('Skype: lllfeverlll', 10, 100, 280, 20)
	GUICtrlSetFont(-1, 8.5, 800, 0, 'Tahoma')
	GUICtrlCreateLabel('© Fever   2010', 10, 120, 280, 20, $SS_CENTER)
	GUICtrlSetFont(-1, 8.5, 800, 0, 'Tahoma')
	GUICtrlCreateLabel('', 10, 135, 280, 0, $SS_ETCHEDHORZ)
	GUICtrlCreateLabel('USING THIS PROGRAM YOU AUTOMATICALY AGREE WITH THE LICENSE. THE AUTHOR ASSUMES NO RESPONSIBILITY FOR DAMAGES THAT MAY OCCUR FROM USING THIS SOFTWARE.', 10, 140, 280, 80, $SS_CENTER)
	GUICtrlSetColor(-1, 0x606060)
EndFunc
;---
Func Close()
	$TIME = 0
	Exit
EndFunc
Screenshot: screenshoot_001.jpg

screenshoot_002.jpg
Источник: Fever

Скачать
 

kaster

Мой Аватар, он лучший самый
Команда форума
Глобальный модератор
Сообщения
4 020
Репутация
622
Пусть люди потестируют. Если все норм, то перенесу в раздел проектов
 

Garrett

Модератор
Локальный модератор
Сообщения
3 999
Репутация
964
У самого лежит недоделанный проект. Заморозил пока :smile:
Каждый раз возникают новые подводные камни, и новые хотелки. Все никак не определюсь с условиями. :smile:
Так что тема близка, и интересная, будим тестировать! Тем более дома есть "супер" хакер ;D
 
Верх