BitByteBit Posted June 29, 2009 Share Posted June 29, 2009 (edited) I'd like to setup a a program so that you can : 1.Press a hotkey 2.Input a name 3.Input a time in minutes 4.Have a msgbox pop up at the defined time with the message of please call "XXX" Once this is dont the script must not close and you must be able to press the hotkey again. Also I would like to know if you can have multiple reminders at once. Thank you for your time and help. This is the code i have so far: HotKeySet("+!d", "Define") dim $60Count, $begin, $Count , $dif,$dif2,$DoIt,$Ignition,$Minutes,$Name,$Time Func Define() $Name = InputBox ("Name","Please type the name and number of the person you need to call") $Time = InputBox("Time","Please enter a time in minutes") $DoIt = 0 MsgBox(0,"Test","test") Timer() EndFunc Local $60Count = 0, $begin = TimerInit() Func Timer() While $Time > $60Count $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") -1) $Count = int($dif/1000) $60Count = Int($Count / 60) ToolTip("Minutes Required = " & $Time & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1) Sleep(20) WEnd EndFunc Func msg() MsgBox(64, "Reminder", "Please call " & $Name);If $DoIt = 1 then EndFunc Edited June 29, 2009 by BitByteBit Link to comment Share on other sites More sharing options...
Mat Posted June 29, 2009 Share Posted June 29, 2009 HotKeySet("!D", "Define") While 1 Sleep (5000) WEnd Func Define() HotKeySet ("!D") $Name = InputBox ("Name","Please type the name and number of the person you need to call") $Time = InputBox("Time","Please enter a time in minutes") Timer ($Name, $Time) EndFunc Func Timer($name, $time) Local $begin = TimerInit(), $CountMin = 0 While $Time > $CountMin $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") - 1) $Count = int ($dif/1000) $CountMin = Int ($Count / 60) ToolTip("Minutes Required = " & $Time & @CRLF & "Minutes Past = " & $CountMin & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1) Sleep(20) WEnd ToolTip ("", "") Msg($Name) EndFunc Func msg($Name) MsgBox(64, "Reminder", "Please call " & $Name) Exit EndFunc Works a treat Mistakes: * Variables were a mess * +!d = !D MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
BitByteBit Posted June 29, 2009 Author Share Posted June 29, 2009 Thank you sooooo much!!! I really appreciate that you took the time to help me with this! Two small things The script closes after it shows the reminder and I need to be able to make another reminder without running the .exe again Is it possible to have multiple reminders at one time? Possibly using an array? Link to comment Share on other sites More sharing options...
Mat Posted June 29, 2009 Share Posted June 29, 2009 (edited) right... A couple of un thought of errors delayed this somewhat, yet its now up and running. This is turning out to be a neat lil script. expandcollapse popupGlobal $aTimes[1][4] = [[0, 0, 0, 0]] HotKeySet("!D", "Define") Global $hGUI = GUICreate ("Call Timer!", 200, 300, 0, 0, -1, 0x00000008) Global $hList = GUICtrlCreateListView ("Name|Time|Time Left", 2, 2, 196, 296) GUISetState () While GUIGetMsg () <> -3 For $i = 1 to $aTimes[0][0] $temp = TimerDiff ($aTimes[$i][2]) - $aTimes[$i][1] $temp /= 60000 $Temp = StringReplace (Round ($temp, 2), ".", ":") $Temp = StringTrimRight ($Temp, 2) & Round (0.6 * StringRight ($Temp, 2), 0) If StringLeft (StringRight ($Temp, 2), 1) = ":" Then $Temp = StringTrimRight ($temp, 1) & "0" & StringRight ($Temp, 1) If StringLeft ($temp, 1) = "-" Then $Temp = StringTrimLeft ($temp, 1) If StringInStr ($Temp, ":") <> 0 Then GUICtrlSetData ($aTimes[$i][3], StringRegExpReplace (StringTrimRight (GUICtrlRead ($aTimes[$i][3]), 1), _ "(\|.*\|).*", "\1") & $Temp) If TimerDiff ($aTimes[$i][2]) >= $aTimes[$i][1] Then ; Time Is Up!! GUICtrlDelete ($aTimes[$i][3]) MsgBox(64, "Reminder", "Please call " & $aTimes[$i][0]) $aTimes[0][0] -= 1 Redim $aTimes[UBound ($aTimes, 1) - 1][4] ExitLoop EndIf Next Sleep(20) WEnd Func Define() Redim $aTimes[UBound ($aTimes, 1) + 1][4] $aTimes[0][0] += 1 $aTimes[UBound ($aTimes, 1) - 1][0] = InputBox ("Name","Please type the name and number of the person you need to call") $aTimes[UBound ($aTimes, 1) - 1][1] = InputBox("Time","Please enter a time in minutes") $aTimes[UBound ($aTimes, 1) - 1][2] = TimerInit () If StringInStr ($aTimes[UBound ($aTimes, 1) - 1][1], ".") Then $temp = StringReplace (Round ($aTimes[UBound ($aTimes, 1) - 1][1], 2), ".", ":") If StringLeft (StringRight ($Temp, 2), 1) = ":" Then $Temp &= "0" If StringLeft ($temp, 1) = "-" Then $Temp = StringTrimLeft ($temp, 1) $aTimes[UBound ($aTimes, 1) - 1][1] *= 60000 ElseIf StringInStr ($aTimes[UBound ($aTimes, 1) - 1][1], ":") Then $Temp = $aTimes[UBound ($aTimes, 1) - 1][1] $aTimes[UBound ($aTimes, 1) - 1][1] = (StringRegExpReplace ($aTimes[UBound ($aTimes, 1) - 1][1], ":.*", "") * 60000) + ( _ StringRegExpReplace ($aTimes[UBound ($aTimes, 1) - 1][1], ".*:", "") * 1000) Else $Temp = $aTimes[UBound ($aTimes, 1) - 1][1] & ":00" $aTimes[UBound ($aTimes, 1) - 1][1] *= 60000 EndIf $aTimes[UBound ($aTimes, 1) - 1][3] = GUICtrlCreateListViewItem ( _ $aTimes[UBound ($aTimes, 1) - 1][0] & "|" & $Temp & "|" & $Temp, $hList) EndFunc ; ==> Define MDiesel Edit: Dodgy code. Edit2: Now supports time inputted as "5.5", 5:30" or just "5" Edited June 29, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now