Now you can tie yourself with ropes and setup the program to play a soundfile very loud (like a porn film), so if you do not can untie yourself before the timer ends the neighbours will hear an embarasing noize coming from your home.
As in the old times, any feedback will be much aprecciatted.
Code: Select all
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=ico.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Language=1027
#AutoIt3Wrapper_Res_File_Add=logo.jpg, rt_rcdata, TEST_JPG_1
#AutoIt3Wrapper_Res_File_Add=banner.jpg, rt_rcdata, TEST_JPG_2
#AutoIt3Wrapper_Res_File_Add=llave.gif, rt_rcdata, TEST_GIF_1
#AutoIt3Wrapper_Res_File_Add=beep.gif, rt_rcdata, TEST_GIF_2
#AutoIt3Wrapper_Res_File_Add=random.gif, rt_rcdata, TEST_GIF_3
#AutoIt3Wrapper_Res_File_Add=escape.gif, rt_rcdata, TEST_GIF_4
#AutoIt3Wrapper_Res_File_Add=clock.gif, rt_rcdata, TEST_GIF_5
#AutoIt3Wrapper_Res_File_Add=donate.gif, rt_rcdata, TEST_GIF_6
#AutoIt3Wrapper_Res_File_Add=randomplus.gif, rt_rcdata, TEST_GIF_7
#AutoIt3Wrapper_Res_File_Add=battery.gif, rt_rcdata, TEST_GIF_8
#AutoIt3Wrapper_Res_File_Add=program.gif, rt_rcdata, TEST_GIF_9
#AutoIt3Wrapper_Res_File_Add=restart.gif, rt_rcdata, TEST_GIF_10
#AutoIt3Wrapper_Res_File_Add=save.gif, rt_rcdata, TEST_GIF_11
#AutoIt3Wrapper_Res_File_Add=erase2.gif, rt_rcdata, TEST_GIF_12
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <resources.au3>
#include <string.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <GuiComboBox.au3>
#include <ComboConstants.au3>
#include <StaticConstants.au3>
#include <SendMessage.au3>
#include <ButtonConstants.au3>
#include <ProgressConstants.au3>
#include <UpdownConstants.au3>
#include <Process.au3>
#include <timers.au3>
;~ vars that must be declared
Global $minVal = 0, $maxVal = 5999
Global $ExitButton
Global $Result
Global $msg
Global $lpszCommand
Global $A
Global $input3
Global $TT
Global $var
Global $Volume
Global $gi_Drive
Global $message5
Global $cboDrive
Global $z
Global $y
Global $CHECKBOXR
Global $CHECKBOXRANDOM
Global $nuevo
Global $pepe
Global $pepito
Global $STATERANDOM
Global $titulo
Global $comprobamos
Global $tiempodemas
Global $CHECKBOXESPACE
Global $U
Global Const $WM_POWERBROADCAST = 0x0218
Global Const $WM_POWERBROADCAST2 = 0x0218
Global Const $WM_POWERBROADCAST3 = 0x0218
Global Const $WM_POWERBROADCAST4 = 0x0218
Global Const $PBT_APMQUERYSUSPEND = 0x0000
Global $PBT_APMSUSPEND = 0x0004
Global $PBT_APMSTANDBY = 0x0005
Global $PBT_APMBATTERYLOW = 0x0009
Global $PBT_APMPOWERSTATUSCHANGE = 0x000A
Global Const $ENDSESSION_CLOSEAPP = 0x00000001
Global Const $ENDSESSION_CRITICAL = 0x40000000
Global Const $ENDSESSION_LOGOFF = 0x80000000
Global Const $shutdown_or_restart = 0x0
Global $array
Global $Result
Global $hwnd
Global $altura
Global $anchura
Global $posicion
Global $ProgressBar100
Global $bateria
Global $gui4
Global $gui8
Global $count
Global $okbtn
Global $Alien1
Global $Alien2
Global $Alien3
Global $Alien4
Global $Alien5
Global $Alien6
Global $Alien7
Global $Alien8
Global $testbtn0
Global $WW1
Global $FileName1
Global $MaxTime
Global $Time = IniRead(@ScriptDir & "\Settings.ini", "Settings", "Time", "60")
If Not StringIsDigit($Time) Then
$Time = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Time", "60")
$Time = 60
EndIf
Global $LowerBattery = IniRead(@ScriptDir & "\Settings.ini", "Settings", "LowerBattery%", "25")
If Not StringIsDigit($LowerBattery) Then
$LowerBattery = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "LowerBattery%", "25")
$LowerBattery = 25
Else
If $LowerBattery < 10 Then
$LowerBattery = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "LowerBattery%", "10")
$LowerBattery = 10
ElseIf $LowerBattery > 90 Then
$LowerBattery = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "LowerBattery%", "90")
$LowerBattery = 90
EndIf
EndIf
Global $RamdomSession = IniRead(@ScriptDir & "\Settings.ini", "Settings", "RandomSession", "No")
Global $RandomTime = IniRead(@ScriptDir & "\Settings.ini", "Settings", "RandomTime", "1")
If Not StringIsDigit($RandomTime) Then
$RandomTime = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "RandomTime", "1")
$RandomTime = 1
Else
If $RandomTime < 0 Then
$RandomTime = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "RandomTime", "1")
$RandomTime = 1
ElseIf $RandomTime > $Time Then
$RandomTime = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "RandomTime", $Time)
$RandomTime = $Time
EndIf
EndIf
Global $RandomTimeshowed = IniRead(@ScriptDir & "\Settings.ini", "Settings", "ShowRemainingTime", "No")
Global $Beep = IniRead(@ScriptDir & "\Settings.ini", "Settings", "Beep", "Yes")
Global $Restart = IniRead(@ScriptDir & "\Settings.ini", "Settings", "HotkeyRestart", "No")
Global $TimeAdded = IniRead(@ScriptDir & "\Settings.ini", "Settings", "TimeAdded", "1")
If Not StringIsDigit($TimeAdded) Then
$TimeAdded = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "TimeAdded", "1")
$RandomTime = 1
Else
If $TimeAdded < 0 Then
$TimeAdded = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "TimeAdded", "0")
$TimeAdded = 0
ElseIf $TimeAdded > 999 Then
$TimeAdded = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "TimeAdded", "999")
$TimeAdded = 999
EndIf
EndIf
Global $ReleaseProgram = IniRead(@ScriptDir & "\Settings.ini", "Settings", "ReleaseProgram", "")
;~ only one Selfbondage CD Tray Opener at time
_Singleton("Unique String Here")
;~ the main window of the program
$myGUI = GUICreate(" Selfbondage CD Tray Opener Simple Version 1.6", 420, 570, -1, -1)
GUISetState(@SW_SHOW)
Func _BatteryQueryEx()
Local $SystemPower, $ret, $array[5]
; Setup $array and $SystemPower
$SystemPower = DllStructCreate("ubyte;ubyte;ubyte;ubyte;ulong;ulong")
If @error Then
SetError(-1)
Return $array
EndIf
; make the DllCall
$ret = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($SystemPower))
If @error Then;DllCall Failed
SetError(-2)
$SystemPower = 0
Return $array
EndIf
If Not $ret[0] Then; GetSystemPowerStatus Failed
SetError(-3)
$SystemPower = 0
Return $array
EndIf
; Fill the array
$array[0] = DllStructGetData($SystemPower, 1); AC
$array[1] = DllStructGetData($SystemPower, 2); Battery Charge
$array[2] = DllStructGetData($SystemPower, 3); Battery Charge %
$array[3] = DllStructGetData($SystemPower, 5); Sec Battery Left
$array[4] = DllStructGetData($SystemPower, 6); Sec Battery Capacity @ Full Charge
If $array[2] < $bateria Then
MsgBox(4096, "WARNING!", "Opening tray due to low battery level", 10)
Sleep(10)
On_Exit()
EndIf
; free the struct
$SystemPower = 0
Return $array
EndFunc ;==>_BatteryQueryEx
$WM_QUERYENDSESSION = 0x11
GUIRegisterMsg($WM_QUERYENDSESSION, "Cancel_Shutdown")
Func _ShutdownBlockReasonCreate($hwnd, $wStr)
; http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx
; Prog@ndy
Local $aResult = DllCall("User32.dll", "int", "ShutdownBlockReasonCreate", "hwnd", $hwnd, "wstr", $wStr)
If @error Then Return SetError(1, 0, 0)
Return $aResult[0]
EndFunc ;==>_ShutdownBlockReasonCreate
Func _ShutdownBlockReasonDestroy($hwnd)
Local $aResult = DllCall("User32.dll", "int", "ShutdownBlockReasonDestroy", "hwnd", $hwnd)
If @error Then Return SetError(1, 0, 0)
Return $aResult[0]
EndFunc ;==>_ShutdownBlockReasonDestroy
Func Cancel_Shutdown($hWndGUI, $MsgID, $WParam, $LParam)
; This HAS to be here to capture the endsession...
AdlibRegister("Cancel_ShutdownResolver", 50)
Return False
EndFunc ;==>Cancel_Shutdown
Func Cancel_ShutdownResolver()
Local $iOpt = Opt("WinTitleMatchMode", 4), $hwnd = WinGetHandle("[CLASS:BlockedShutdownResolver]")
Opt("WinTitleMatchMode", $iOpt)
If $hwnd Then
If @OSVersion = "WIN_7" Then ControlClick($hwnd, "", "[CLASS:Button; INSTANCE:1]")
If @OSVersion <> "WIN_7" Then ControlClick($hwnd, "", "[CLASS:Button; INSTANCE:2]")
AdlibUnRegister("Cancel_ShutdownResolver")
EndIf
EndFunc ;==>Cancel_ShutdownResolver
;~ link with the email
$c_Hyperlink_FunkEu = GUICtrlCreateLabel("Contact", 4, 552)
GUICtrlSetFont(-1, 9, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState(@SW_SHOW); will display an empty dialog box
$count = 1
;~ Labels with the security warnings and the time input
GUICtrlCreateLabel("» Use only with laptops or computers connected to an UPS system !", 51, 125)
GUICtrlCreateLabel("» Do NOT use without an alternative release method !! Visit to learn more:", 38, 140)
GUICtrlCreateLabel("Type how many MINUTES you want to wait and press START: ", 48, 218)
GUICtrlSetFont(9, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000AE)
$comprobamos = 0
;~ time input box
$input = GUICtrlCreateInput($Time, 353, 214, 50, 20, $ES_NUMBER)
GUICtrlSetBkColor(-1, 0xaeee00)
$updown = GUICtrlCreateUpdown($input)
GUICtrlSetLimit($updown, 5999, 1)
GUICtrlCreateLabel(" ", 9951, 125)
;~ battery input box
$input10 = GUICtrlCreateInput($LowerBattery, 322, 276, 42, 20, $ES_NUMBER)
GUICtrlSetBkColor(-1, 0xffcc66)
$updown10 = GUICtrlCreateUpdown($input10)
GUICtrlSetLimit($updown10, 99, 15)
;~ the program asks if play a beep during the countdown
$CHECKBOX = GUICtrlCreateCheckbox(" Beep during the countdown?", 140, 306, 180, 20)
$ini = IniRead(@ScriptDir & "\Settings.ini", "Settings", "Beep", "Yes")
If $ini = "Yes" Then
GUICtrlSetState($CHECKBOX, $GUI_CHECKED)
Else
GUICtrlSetState($CHECKBOX, $GUI_UNCHECKED)
EndIf
;~ the program asks if use the random time function
$CHECKBOX2 = GUICtrlCreateCheckbox("Play with random time? (If so, type the max. and the min. time)", 50, 333, 309, 20)
$ini2 = IniRead(@ScriptDir & "\Settings.ini", "Settings", "RandomSession", "No")
If $ini2 = "Yes" Then
GUICtrlSetState($CHECKBOX2, $GUI_CHECKED)
Else
GUICtrlSetState($CHECKBOX2, $GUI_UNCHECKED)
EndIf
;~ the program asks if showing the remaining time during a random timed session
$CHECKBOXRANDOM = GUICtrlCreateCheckbox("Show remaining time during random time mode?", 95, 361, 309, 20)
$ini3 = IniRead(@ScriptDir & "\Settings.ini", "Settings", "ShowRemainingTime", "No")
If $ini3 = "Yes" Then
GUICtrlSetState($CHECKBOXRANDOM, $GUI_CHECKED)
Else
GUICtrlSetState($CHECKBOXRANDOM, $GUI_UNCHECKED)
EndIf
;~ the program asks if pressing escape during the countdown the program exits
$CHECKBOX20 = GUICtrlCreateCheckbox("Use 'Escape' as hotkey to finish session?", 125, 392, 309, 20)
$ini4 = IniRead(@ScriptDir & "\Settings.ini", "Settings", "HotkeyEscape", "Yes")
If $ini4 = "Yes" Then
GUICtrlSetState($CHECKBOX20, $GUI_CHECKED)
Else
GUICtrlSetState($CHECKBOX20, $GUI_UNCHECKED)
EndIf
$inputrandom = GUICtrlCreateInput($RandomTime, 360, 333, 48, 20, $ES_NUMBER)
GUICtrlSetBkColor(-1, 0xffff00)
$updownrandom = GUICtrlCreateUpdown($inputrandom)
GUICtrlSetLimit($updownrandom, 900, 1)
;~ the program looks how many cd drives we have on the computer
Local $a_DriveList = DriveGetDrive('CDROM'), $s_DriveList
For $i_aDriveList = 1 To UBound($a_DriveList) - 1
$s_DriveList &= StringUpper($a_DriveList[$i_aDriveList]) & '|'
Next
Local $cboDrive = GUICtrlCreateCombo("", 323, 245, 40, 30, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, $s_DriveList)
_GUICtrlComboBox_SetCurSel($cboDrive, 0)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("Choose what CD Drive must be opened during the session:", 37, 250)
GUICtrlSetFont(9, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000AE)
$testbtn = GUICtrlCreateButton("Test", 366, 244, 33, 23)
$U = GUICtrlRead($cboDrive)
GUICtrlCreateLabel("%", 370, 280)
GUICtrlCreateLabel("Please input the LOWER battery level allowed:", 92, 280)
GUICtrlSetFont(9, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000AE)
;~ We create the START and EXIT buttons (START is by default remarked)
$okbtn = GUICtrlCreateButton("START SESSION", 120, 538, 180, 30)
GUICtrlSetState(-1, 512)
;~ the logo of the program, when compiling all the stuff must be in the same directory as the source
$Pic1 = GUICtrlCreatePic("", 20, 0, 400, 111)
_ResourceSetImageToCtrl($Pic1, "TEST_JPG_1")
;~ the boundanna banner
Global $Pic2 = GUICtrlCreatePic("", 40, 163, 400, 44)
_ResourceSetImageToCtrl($Pic2, "TEST_JPG_2")
GUICtrlSetCursor($Pic2, 0)
;~ the key pic
$Pic3 = GUICtrlCreatePic("", 20, 214, 22, 22)
_ResourceSetImageToCtrl($Pic3, "TEST_GIF_1")
;~ the beep pic
$Pic4 = GUICtrlCreatePic("", 110, 302, 22, 22)
_ResourceSetImageToCtrl($Pic4, "TEST_GIF_2")
;~ the random pic
$Pic5 = GUICtrlCreatePic("", 20, 327, 20, 25)
_ResourceSetImageToCtrl($Pic5, "TEST_GIF_3")
;~ the escape pic
$Pic6 = GUICtrlCreatePic("", 88, 390, 24, 24)
_ResourceSetImageToCtrl($Pic6, "TEST_GIF_4")
;~ the more time pic
$Pic7 = GUICtrlCreatePic("", 45, 397 + 20, 20, 25)
_ResourceSetImageToCtrl($Pic7, "TEST_GIF_7")
;~ the battery pic
$Pic10 = GUICtrlCreatePic("", 59, 270, 26, 26)
_ResourceSetImageToCtrl($Pic10, "TEST_GIF_8")
;~ the program asks if pressing r during the countdown the restarts the counter
$CHECKBOXR = GUICtrlCreateCheckbox("Use 'R' as hotkey to restart the counter?", 125, 452, 309, 20)
$ini5 = IniRead(@ScriptDir & "\Settings.ini", "Settings", "HotkeyRestart", "Yes")
If $ini5 = "Yes" Then
GUICtrlSetState($CHECKBOXR, $GUI_CHECKED)
Else
GUICtrlSetState($CHECKBOXR, $GUI_UNCHECKED)
EndIf
;~ the beep pic
$Pic44 = GUICtrlCreatePic("", 95, 447, 20, 25)
_ResourceSetImageToCtrl($Pic44, "TEST_GIF_10")
GUICtrlCreateLabel("Execute a program when countdow ends", 125, 486, 309, 25)
GUICtrlSetFont(9, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000AE)
$default1 = $ReleaseProgram
$WW1 = $default1
$INPUT130 = GUICtrlCreateInput($default1, 55, 506, 255, 23)
GUICtrlSetBkColor(-1, 0xaeee00)
$savebtn1 = GUICtrlCreateButton("Change", 312, 505, 45, 23)
$testbtn1 = GUICtrlCreateButton("Test", 359, 505, 34, 23)
$erase = GUICtrlCreateButton("", 395, 505, 23, 23)
_ResourceSetImageToCtrl($erase, "TEST_GIF_12")
;~ the program pic
$Pic11 = GUICtrlCreatePic("", 15, 493, 30, 25)
_ResourceSetImageToCtrl($Pic11, "TEST_GIF_9")
;~ this is the function that works when we press the email link
Func MY_WM_COMMAND($hwnd, $msg, $WParam, $LParam)
Local $iIDFrom = BitAND($WParam, 0xFFFF);LoWord
Switch $iIDFrom
Case $c_Hyperlink_FunkEu
ShellExecute("mailto:qwertybcn121@gmail.com")
EndSwitch
EndFunc ;==>MY_WM_COMMAND
$btnPayMe = GUICtrlCreateButton("", 358, 548, 60, 20)
_ResourceSetImageToCtrl($btnPayMe, "TEST_GIF_6")
$Save = GUICtrlCreateButton("", 327, 544, 26, 26)
_ResourceSetImageToCtrl($Save, "TEST_GIF_11")
;~ the program asks if pressing escape during the countdown the program exits
GUICtrlCreateLabel("Minutes added to the countdown if 'Espace' bar is pressed:", 70, 425, 309, 20)
GUICtrlSetFont(9, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000AE)
$inputespace = GUICtrlCreateInput($TimeAdded, 355, 422, 48, 20, $ES_NUMBER)
GUICtrlSetBkColor(-1, 0xffff00)
$updownespace = GUICtrlCreateUpdown($inputespace)
GUICtrlSetLimit($updownespace, 999, 0)
$anchura = 680
$altura = 180
; Find taskbar
Local $iPrevMode = AutoItSetOption("WinTitleMatchMode", 4)
Local $aTaskBar_Pos = WinGetPos("classname=Shell_TrayWnd")
AutoItSetOption("WinTitleMatchMode", $iPrevMode)
;~ we press the tab button to get the cursor on the time input
Send("{TAB}")
HotKeySet("{ESC}", "On_Exit2")
HotKeySet("{SPACE}", "_morewait")
HotKeySet("{r}", "_restart")
;nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
While 1
;~ force the gui to still opened:
$msg = GUIGetMsg()
$TT = GUICtrlRead($input3)
$bateria = GUICtrlRead($input10)
$U = GUICtrlRead($cboDrive)
;~ here we check the state of the checkboxes to activate the beep (CHECKBOX) and to activate the Random time mode(CHECKBOX 2)
If GUICtrlRead($CHECKBOX) = 1 Then
$STATE = "CHECK"
Else
$STATE = "UNCHECK"
EndIf
If GUICtrlRead($CHECKBOX2) = 1 Then
$STATE2 = "CHECK"
Else
$STATE2 = "UNCHECK"
EndIf
If GUICtrlRead($CHECKBOX20) = 1 Then
$STATE20 = "CHECK"
Else
$STATE20 = "UNCHECK"
EndIf
If GUICtrlRead($CHECKBOXR) = 1 Then
$STATER = "CHECK"
Else
$STATER = "UNCHECK"
EndIf
If GUICtrlRead($CHECKBOXRANDOM) = 1 Then
$STATERANDOM = "CHECK"
Else
$STATERANDOM = "UNCHECK"
EndIf
;~ if the random time is checked, then we will use the input time * 60 (to pass from minutes to seconds) and we call this variable $Q
If $STATE2 = "CHECK" Then
$Q = 1
Else
$Q = GUICtrlRead($input) * 60
EndIf
Select
;~ here we tell the program that if exit button is pressed it may close the program
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $testbtn
CDTray($U, "open")
Case $msg = $Save
saveconfig()
Case $msg = $savebtn1
$destino1 = FileOpenDialog("Choose what script do you want to run as release method.", @ScriptDir, "Release Method (*.*)")
If @error Then
GUICtrlSetData($INPUT130, $default1)
$WW1 = $default1
Else
GUICtrlSetData($INPUT130, $destino1)
$WW1 = $destino1
EndIf
Case $msg = $erase
$default1 = ""
GUICtrlSetData($INPUT130, $default1)
$WW1 = $default1
Case $msg = $testbtn1
ShellExecuteWait($WW1)
;~ link to boundanna
Case $msg = $Pic2
ShellExecute("http://www.boundanna.com")
Case $msg = $btnPayMe
ShellExecute("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick¤cy_code=USD&hosted_button_id=QKEQWHDTDSBZ4");
Case $msg = $okbtn
If $bateria > 90 Then
GUICtrlSetData($input10, 90)
MsgBox(48, "WARNING!", "The LOWER allowed battery level" & @CRLF & "before opening the CD Tray" & @CRLF & "must be less than 90%" & @CRLF & " " & @CRLF & "For this sessions it will be set at 90%", 10)
EndIf
If $bateria < 10 Then
GUICtrlSetData($input10, 10)
MsgBox(48, "WARNING!", "The LOWER allowed battery level" & @CRLF & "before opening the CD Tray" & @CRLF & "must be bigger than 10%" & @CRLF & " " & @CRLF & "For this sessions it will be set at 10%", 10)
EndIf
$read = GUICtrlRead($input)
If GUICtrlRead($CHECKBOX2) = 1 And GUICtrlRead($inputrandom) >= $Read Then
MsgBox(48, "WARNING!", "You've choosed a minimum desired time" & @CRLF & "equal or higher than the maximum desired time" & @CRLF & "for a random timed session" & @CRLF & "" & @CRLF & "" & @CRLF & "This may result in a program hanging" & @CRLF & "So please change your settings")
Else
If $read < $minVal Or $read > $maxVal Then
GUICtrlSetData($input, '')
MsgBox(48, "Time limitation", "This program only allows" & @CRLF & "selfbondage sessions" & @CRLF & "up to 5999 minutes" & @CRLF & " " & @CRLF & "If you want a longuer limit" & @CRLF & "please contact me")
;~ If the input of time is lower than 900 it will read some of the inputs and will close the gui to let the coundown work
Else
$yprogre = GUICtrlRead($input)
Sleep(20)
GUICtrlRead($inputrandom)
Sleep(20)
$U = GUICtrlRead($cboDrive) ;reads what cd drive must be used on the session
Sleep(20)
$bateria = GUICtrlRead($input10)
Sleep(20)
GUICtrlRead($CHECKBOX20)
Sleep(20)
$tiempodemas = GUICtrlRead($inputespace)
Sleep(20)
$comprobamos = 1
Sleep(20)
GUISetState(@SW_HIDE, $myGUI)
Sleep(20)
cuenta()
EndIf
EndIf
EndSelect
WEnd
Func saveconfig()
$yprogre = GUICtrlRead($input)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Time", $yprogre)
$bateria = GUICtrlRead($input10)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "LowerBattery%", $bateria)
If GUICtrlRead($CHECKBOX2) = 1 Then
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "RandomSession", "Yes")
Else
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "RandomSession", "No")
EndIf
$randomtiempo = GUICtrlRead($inputrandom)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "RandomTime", $randomtiempo)
If GUICtrlRead($CHECKBOXRANDOM) = 1 Then
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "ShowRemainingTime", "Yes")
Else
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "ShowRemainingTime", "No")
EndIf
If GUICtrlRead($CHECKBOX) = 1 Then
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Beep", "Yes")
Else
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Beep", "No")
EndIf
If GUICtrlRead($CHECKBOX20) = 1 Then
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "HotkeyEscape", "Yes")
Else
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "HotkeyEscape", "No")
EndIf
If GUICtrlRead($CHECKBOXR) = 1 Then
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "HotkeyRestart", "Yes")
Else
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "HotkeyRestart", "No")
EndIf
$tiempodemas = GUICtrlRead($inputespace)
$TimeAdded = IniWrite(@ScriptDir & "\Settings.ini", "Settings", "TimeAdded", $tiempodemas)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "ReleaseProgram", $WW1)
EndFunc ;==>saveconfig
Func On_Exit2()
If $STATE20 = "CHECK" Then
If $WW1 <> "" Then
ShellExecute($WW1)
EndIf
CDTray($U, "open")
Sleep(300)
CDTray($U, "open")
Exit
Else
Beep(100, 200)
EndIf
EndFunc ;==>On_Exit2
Func CLOSEClicked()
Exit
EndFunc ;==>CLOSEClicked
Func cuenta()
If $STATER = "UNCHECK" Then
$nuevo = ""
EndIf
If $STATER = "CHECK" Then
$nuevo = " Press R to restart counter"
EndIf
If $STATE2 = "UNCHECK" Then
Global $MaxTime = GUICtrlRead($input) * 60 ;reads the time in the input
$pepe = $MaxTime
$pepito = $MaxTime
$y = $MaxTime
Else
Global $MaxTime = Random(GUICtrlRead($inputrandom) * 60, GUICtrlRead($input) * 60, 1)
$pepe = $MaxTime
$pepito = $MaxTime
$y = $MaxTime
EndIf
If $STATE2 = "UNCHECK" Then
$gui8 = GUICreate(" TIME LEFT", 140, @DesktopHeight - $aTaskBar_Pos[3], @DesktopWidth - 140, 0)
GUISetState(@SW_HIDE, $gui8)
Sleep(20)
$Pic19 = GUICtrlCreatePic("", 37, 15, 66, 113)
_ResourceSetImageToCtrl($Pic19, "TEST_GIF_5")
Sleep(20)
$yprogre = GUICtrlRead($input)
Sleep(20)
$yprogre2 = $MaxTime
Sleep(20)
$yprogre3 = ($yprogre2 / $yprogre2) * 100
Sleep(20)
$ProgressBar100 = GUICtrlCreateProgress(5, 150, 120, @DesktopHeight - $aTaskBar_Pos[3] - 180, $PBS_VERTICAL, $PBS_SMOOTH)
Sleep(20)
GUICtrlSetData($ProgressBar100, $yprogre3)
Sleep(20)
$alturabarras = @DesktopHeight - $aTaskBar_Pos[3] - 400
Sleep(20)
cuneta1()
EndIf
If $STATE2 = "CHECK" And $STATERANDOM = "UNCHECK" Then
cuneta2()
EndIf
If $STATE2 = "CHECK" And $STATERANDOM = "CHECK" Then
$gui8 = GUICreate(" TIME LEFT", 140, @DesktopHeight - $aTaskBar_Pos[3], @DesktopWidth - 140, 0)
GUISetState(@SW_HIDE, $gui8)
Sleep(20)
$Pic19 = GUICtrlCreatePic("", 37, 15, 66, 113)
_ResourceSetImageToCtrl($Pic19, "TEST_GIF_5")
Sleep(20)
Sleep(20)
$yprogre2 = $MaxTime
Sleep(20)
$yprogre3 = ($yprogre2 / $yprogre2) * 100
Sleep(20)
$ProgressBar100 = GUICtrlCreateProgress(5, 150, 120, @DesktopHeight - $aTaskBar_Pos[3] - 180, $PBS_VERTICAL, $PBS_SMOOTH)
Sleep(20)
GUICtrlSetData($ProgressBar100, $yprogre3)
Sleep(20)
$alturabarras = @DesktopHeight - $aTaskBar_Pos[3] - 400
Sleep(20)
cuneta3()
EndIf
EndFunc ;==>cuenta
Func cuneta1()
If GUICtrlRead($CHECKBOX20) = 1 And $tiempodemas > 0 Then
$titulo = "Press Escape to close the program Press Espace Bar to add " & $tiempodemas & " minutes" & $nuevo
Sleep(20)
EndIf
If $STATE20 = "UNCHECK" And $tiempodemas > 0 Then
$titulo = "Press Espace Bar to add " & $tiempodemas & " minutes" & $nuevo
Sleep(20)
EndIf
If $STATE20 = "UNCHECK" And $tiempodemas < 1 Then
$titulo = "Selfbondage CD Tray Opener Simple Version 1.6" & $nuevo
Sleep(20)
EndIf
If GUICtrlRead($CHECKBOX20) = 1 And $tiempodemas < 1 Then
$titulo = "Press Escape to close the program" & $nuevo
Sleep(20)
EndIf
Sleep(20)
;~ if the random time is unchecked, then we use the input value * 60 (to pass from minutes to seconds) and we call this variable $Y
Sleep(100)
$y = $MaxTime
; the countdown starts. Y value will be the waiting time in seconds
$gui6 = GUICreate($titulo, $anchura, $altura - 50, -1, 0)
$message5 = ""
GUICtrlCreateLabel($message5, 5, 0, 640, 470, $SS_CENTER)
GUICtrlSetFont(-1, 90, 700, 0, "MS Sans Serif")
GUISetBkColor(0xFF0033, $gui6)
GUISetState(@SW_SHOW, $gui6)
GUISetState(@SW_SHOW, $gui8)
GUISwitch($gui6)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
While $MaxTime > 0
$msg = GUIGetMsg()
$message5 = StringFormat("%02d:%02d:%02d\n", Floor($MaxTime / 3600), Mod(Floor($MaxTime / 60), 60), Mod($MaxTime, 60))
ControlSetText($titulo, "", "Static1", $message5)
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] + 1, 0)
Sleep(500)
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] - 1, 0)
Sleep(500)
$MaxTime = $MaxTime - 1
$y = $y - 1
$count = $count + 1
$yprogre2 = $pepe
$yprogre3 = ($yprogre2 / $yprogre2) * 100
$yresultado = $yprogre2 - $y
$yresultado3 = ($yresultado / $yprogre2) * 100
$yresultado4 = $yprogre3 - $yresultado3
GUICtrlSetData($ProgressBar100, $yresultado4)
pitar()
_BatteryQueryEx()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
On_Exit()
Exit
EndFunc ;==>cuneta1
Func cuneta2()
If GUICtrlRead($CHECKBOX20) = 1 And $tiempodemas > 0 Then
$titulo = "Press Escape to close the program Press Espace Bar to add " & $tiempodemas & " minutes" & $nuevo
Sleep(20)
EndIf
If $STATE20 = "UNCHECK" And $tiempodemas > 0 Then
$titulo = "Press Espace Bar to add " & $tiempodemas & " minutes" & $nuevo
Sleep(20)
EndIf
If $STATE20 = "UNCHECK" And $tiempodemas < 1 Then
$titulo = "Selfbondage CD Tray Opener Simple Version 1.6" & $nuevo
Sleep(20)
EndIf
If GUICtrlRead($CHECKBOX20) = 1 And $tiempodemas < 1 Then
$titulo = "Press Escape to close the program" & $nuevo
Sleep(20)
EndIf
Sleep(20)
;~ if the random time is unchecked, then we use the input value * 60 (to pass from minutes to seconds) and we call this variable $Y
Sleep(100)
; Starts the countdown. Z value will be a number between Y (input)*60 and 30
$message5 = ""
$gui66 = GUICreate($titulo, $anchura, $altura - 50, -1, 0)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$Alien1 = Random(33, 64, 1)
$Alien2 = Random(33, 64, 1)
$Alien3 = Random(33, 64, 1)
$Alien4 = Random(33, 64, 1)
$Alien4 = Chr($Alien1)
$Alien5 = Chr($Alien2)
$Alien6 = Chr($Alien3)
$Alien7 = Chr($Alien4)
$message55 = $Alien4 & $Alien5 & $Alien6 & $Alien7
GUICtrlCreateLabel($message55, 10, 0, 640, 470, $SS_CENTER)
GUICtrlSetFont(-1, 80, 700, 0, "Symbol")
GUISetBkColor(0xFF0033, $gui66)
GUISetState(@SW_SHOW, $gui66)
Sleep(100)
; Starts the countdown. Z value will be a number between Y (input)*60 and 30
While $MaxTime > 0
$message = $Alien4 & $Alien5 & $Alien6 & $Alien7
GUICtrlSetFont(-1, 90, 700, 0, "MS Sans Serif")
ControlSetText($titulo, "", "Static1", $message)
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] + 1, 0)
Sleep(500)
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] - 1, 0)
Sleep(500)
$MaxTime = $MaxTime - 1
$y = $y - 1
$count = $count + 1
_BatteryQueryEx()
$Alien1 = Random(33, 64, 1)
$Alien2 = Random(33, 64, 1)
$Alien3 = Random(33, 64, 1)
$Alien4 = Random(33, 64, 1)
$Alien4 = Chr($Alien1)
$Alien5 = Chr($Alien2)
$Alien6 = Chr($Alien3)
$Alien7 = Chr($Alien4)
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
On_Exit()
Exit
EndFunc ;==>cuneta2
Func cuneta3()
If GUICtrlRead($CHECKBOX20) = 1 And $tiempodemas > 0 Then
$titulo = "Press Escape to close the program Press Espace Bar to add " & $tiempodemas & " minutes" & $nuevo
Sleep(20)
EndIf
If $STATE20 = "UNCHECK" And $tiempodemas > 0 Then
$titulo = "Press Espace Bar to add " & $tiempodemas & " minutes" & $nuevo
Sleep(20)
EndIf
If $STATE20 = "UNCHECK" And $tiempodemas < 1 Then
$titulo = "Selfbondage CD Tray Opener Simple Version 1.6" & $nuevo
Sleep(20)
EndIf
If GUICtrlRead($CHECKBOX20) = 1 And $tiempodemas < 1 Then
$titulo = "Press Escape to close the program" & $nuevo
Sleep(20)
EndIf
Sleep(20)
;~ if the random time is unchecked, then we use the input value * 60 (to pass from minutes to seconds) and we call this variable $Y
Sleep(100)
; the countdown starts. Y value will be the waiting time in seconds
$gui6 = GUICreate($titulo, $anchura, $altura - 50, -1, 0)
$message5 = ""
GUICtrlCreateLabel($message5, 5, 0, 640, 470, $SS_CENTER)
GUICtrlSetFont(-1, 90, 700, 0, "MS Sans Serif")
GUISetBkColor(0xFF0033, $gui6)
GUISetState(@SW_SHOW, $gui6)
GUISetState(@SW_SHOW, $gui8)
GUISwitch($gui6)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$y = $MaxTime
While $MaxTime > 0
$msg = GUIGetMsg()
$message5 = StringFormat("%02d:%02d:%02d\n", Floor($MaxTime / 3600), Mod(Floor($MaxTime / 60), 60), Mod($MaxTime, 60))
ControlSetText($titulo, "", "Static1", $message5)
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] + 1, 0)
Sleep(500)
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] - 1, 0)
Sleep(500)
$MaxTime = $MaxTime - 1
$y = $y - 1
$count = $count + 1
$yprogre2 = $pepe
$yprogre3 = ($yprogre2 / $yprogre2) * 100
$yresultado = $yprogre2 - $y
$yresultado3 = ($yresultado / $yprogre2) * 100
$yresultado4 = $yprogre3 - $yresultado3
GUICtrlSetData($ProgressBar100, $yresultado4)
pitar()
_BatteryQueryEx()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
On_Exit()
Exit
EndFunc ;==>cuneta3
Func cambiarcontador()
If $STATE2 = "CHECK" And $STATERANDOM = "UNCHECK" Then
$Alien1 = Random(33, 64, 1)
$Alien2 = Random(33, 64, 1)
$Alien3 = Random(33, 64, 1)
$Alien4 = Random(33, 64, 1)
$Alien4 = Chr($Alien1)
$Alien5 = Chr($Alien2)
$Alien6 = Chr($Alien3)
$Alien7 = Chr($Alien4)
$message55 = $Alien4 & $Alien5 & $Alien6 & $Alien7
ControlSetText($titulo, "", $message5, $message55)
EndIf
EndFunc ;==>cambiarcontador
Func _morewait()
If $comprobamos = 1 Then
If $count >= 1 Then
$count = 0
$chungui = $tiempodemas * 60
$MaxTime = $MaxTime + $chungui
$y = $y + $chungui
$pepe = $MaxTime
$yprogre = $MaxTime / 60
$yprogre2 = $yprogre * 60
$yprogre3 = ($yprogre2 / $yprogre2) * 100
$yresultado = $yprogre2 + $y
$yresultado3 = ($yresultado / $yprogre2) * 100
$yresultado4 = $yprogre3 - $yresultado3
GUICtrlSetData($ProgressBar100, $yresultado4)
EndIf
EndIf
EndFunc ;==>_morewait
Func On_Exit()
If $WW1 <> "" Then
ShellExecute($WW1)
EndIf
CDTray($U, "open")
Sleep(300)
CDTray($U, "open")
Exit
EndFunc ;==>On_Exit
Func pitar()
If $STATE = "CHECK" Then
Beep(600, 100)
EndIf
EndFunc ;==>pitar
Func _restart()
If $STATER = "CHECK" Then
If $MaxTime < $pepito Then
$MaxTime = $pepito
$pepe = $MaxTime
$y = $MaxTime
$yprogre2 = $MaxTime
$yprogre3 = ($yprogre2 / $yprogre2) * 100
$yresultado = $yprogre2 - $y
$yresultado3 = ($yresultado / $yprogre2) * 100
$yresultado4 = $yprogre3 - $yresultado3
GUICtrlSetData($ProgressBar100, $yresultado4)
Else
MsgBox(262192, "NOT ALLOWED", "YOU CAN'T RESTART THE SESSION" & @CRLF & "" & @CRLF & "UNTIL THE VALUE OF THE COUNTDOWN" & @CRLF & "" & @CRLF & "IS LOWER THAN THE TIME INPUTTED" & @CRLF & "" & @CRLF & "AT THE MAIN GUI OF THE PROGRAM", 10)
EndIf
EndIf
EndFunc ;==>_restart