Achilles Posted January 7, 2007 Share Posted January 7, 2007 (edited) This program will let you have a list of reminders and it will pop up with a message box when the selected time/date comes... expandcollapse popup#include <GUIConstants.au3> #Include <GuiListView.au3> #include <String.au3> Opt("TrayMenuMode",1) GuiCreate("Reminder", 600, 500, -1, -1) GUISetBkColor (0x6BC072) $main = GuiCtrlCreateListview("", 5, 5, 590, 445, $LVS_SHOWSELALWAYS) GUICtrlSetBkColor(-1,0xA6D9AA) _GUICtrlListViewInsertColumn($main, 0, "Event", "", 316) _GUICtrlListViewInsertColumn($main, 1, "Time", "", 100) _GUICtrlListViewInsertColumn($main, 2, "Date", "", 100) $addreminder = GuiCtrlCreateButton("Add a new reminder", 15, 460, 230, 30) $deletereminder = GuiCtrlCreateButton("Delete selected reminders", 260, 460, 230, 30) $exit = GuiCtrlCreateButton("Exit", 505, 460, 80, 30) $addReminderItem = TrayCreateItem("Add reminder") TrayCreateItem('') $show = TrayCreateItem("Open Reminder...") $exitItem = TrayCreateItem("Exit") $pastinfo = InireadSectionNames(@ScriptDir & "\reminderinfo.ini") If IsArray($pastInfo) then For $a = 1 to $pastInfo[0] $info = InireadSection(@ScriptDir & "\reminderinfo.ini", $pastinfo[$a]) If IsArray($info) and $info[0][0] <> 0 then For $b = 1 to $info[0][0] $temp = StringSplit($info[$b][1], ":") $pos = _InsertOrder($info[$b][0], $temp[1], $temp[2]) _GUICtrlListViewInsertItem ($main, $pos, $pastinfo[$a] & "|" & $info[$b][1] & "|" & $info[$b][0]) Next Endif Next Endif GUIsetstate() While 1 $msg = GuiGetMsg() $trayMsg = TrayGetMsg() Select Case $msg = $exit Exit Case $msg = $deleteReminder _DeleteReminder() Case $msg = $GUI_EVENT_CLOSE WinSetState('Reminder', '', @SW_HIDE) Case $trayMsg = $exitItem Exit Case $trayMsg = $addreminderItem or $msg = $addReminder _AddReminder() Case $trayMsg = $show WinSetState('Reminder', '', @SW_SHOW) Case Else If _GUICtrlListViewGetItemCount($main) > 0 Then $splitInfo = Stringsplit(_GUICtrlListViewGetItemText($main, 0), "|") $splitDate = Stringsplit($splitInfo[3], "/") $splitTime = Stringsplit($splitInfo[2], ":") If Number($splitDate[3]) <= @YEAR and Number($splitDate[1]) <= @MON and Number($splitDate[2]) <= @MDAY and Number($splitTime[1]) <= @Hour and Number($splitTime[2]) <= @MIN then Msgbox(0, "Reminder alert", $splitInfo[1]) Inidelete(@ScriptDir & "\reminderinfo.ini", $splitInfo[1]) _GUICtrlListViewDeleteItem($main, 0) Endif Endif EndSelect Wend Func _Addreminder() $gui = GuiCreate("Add a reminder", 200, 280) GuiCtrlCreateLabel("Reminder Name", 10, 5, 180, 25, $ES_center) $name = GuiCtrlCreateInput("", 10, 25, 180, 20) $date = GUICtrlCreateMonthCal(@YEAR & "/" & @MON & "/" & @MDAY, 10, 55, 180, 160, $MCS_NOTODAY) GuiCtrlCreateLabel("Hour:", 5, 223, 30, 25, $SS_RIGHT) $hour = GuiCtrlCreateCombo("", 40, 220, 40, 25) GuiCtrlSetData(-1, "0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23") GuiCtrlCreateLabel("Minute:", 100, 223, 35, 25, $SS_RIGHT) $minute = GuiCtrlCreateCombo("", 140, 220, 40, 25) GuiCtrlSetData(-1, "0|5|10|15|20|25|30|35|40|45|50|55") $ok = GuiCtrlCreateButton("Add Reminder", 10, 250, 180, 25) Guisetstate(@SW_SHOW) While 1 $ms = GuiGetMsg() If $ms = $GUI_EVENT_CLOSE then GuiDelete($gui) Return Endif If Bitand($ms = $ok, GuiCtrlRead($name) <> "", GuiCtrlRead($hour) <> "", GuiCtrlRead($minute) <> "") Then $date = Stringsplit(GuiCtrlRead($date), "/") If $date[2] < 10 then $date[2] = StringTrimLeft($date[2], 1) If $date[3] < 10 then $date[3] = StringTrimLeft($date[3], 1) $date = $date[2] & "/" & $date[3] & "/" & $date [1] $hour = GuiCtrlRead($hour) $minute = GuiCtrlRead($minute) If StringLen($minute) < 2 then $minute = _StringInsert($minute, "0", 0) Endif $pos = _InsertOrder($date, $hour, $minute) $time = $hour & ":" & $minute _GUICtrlListViewInsertItem ($main, $pos, GuiCtrlRead($name) & "|" & $time & "|" & $date) If StringLen($hour) < 2 then _StringInsert($hour, "0", 0) Iniwrite(@ScriptDir & "\reminderinfo.ini", GuiCtrlRead($name), $date, $time) GuiDelete($gui) ExitLoop EndIf Wend EndFunc Func _DeleteReminder() $selected = _GUICtrlListViewGetSelectedIndices($main, 1) If $selected <> -1 then If IsArray($selected) then For $a = 1 to $selected[0] $temp = _GUICtrlListViewGetItemTextArray ($main, $selected[$a]) Inidelete(@ScriptDir & "\reminderinfo.ini", $temp[1], $temp[3]) Inidelete(@ScriptDir & "\reminderinfo.ini", $temp[1]) Next Else $temp = _GUICtrlListViewGetItemTextArray ($main, $selected) Inidelete(@ScriptDir & "\reminderinfo.ini", $temp[1], $temp[3]) Inidelete(@ScriptDir & "\reminderinfo.ini", $temp[1]) Endif _GUICtrlListViewDeleteItemsSelected ($main) Endif Endfunc Func _InsertOrder($date, $hour, $minute) $temp = StringSplit($date, "/") Dim $checkInfo[5] = [Int($temp[3]), Int($temp[1]),Int($temp[2]),Int($hour),Int($minute)] If _GUICtrlListViewGetItemCount($main) = 0 then Return -1 For $a = 0 to _GUICtrlListViewGetItemCount($main) $temp = _GUICtrlListViewGetItemTextArray ($main, $a) If IsArray($temp) then $listDate = StringSplit($temp[3], "/") $listTime = StringSplit($temp[2], ":") Dim $listInfo[5] = [Int($listDate[3]),Int($listDate[1]),Int($listDate[2]),Int($listTime[1]),Int($listTime[2])] For $b = 1 to 5 If $checkInfo[$b] < $listInfo[$b] then Return $a If $checkInfo[$b] > $listInfo[$b] then $b += 5 Next Else Return -1 Endif Next Endfunc Please let me know about any bugs/suggestions/comments! EDIT: Does anyone know how to make the font bold for the menu item? Edited January 7, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Charlemagne Posted January 11, 2007 Share Posted January 11, 2007 hey this is cool. i thought i would say something cause noone else was... nice work piano_man Daniel Link to comment Share on other sites More sharing options...
Achilles Posted January 11, 2007 Author Share Posted January 11, 2007 hey this is cool. i thought i would say something cause noone else was... nice work piano_manDanielFinally someone! Thanks Daniel... or Charlemagne (cool name), and welcome to AutoIt! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
n3wbie Posted December 22, 2016 Share Posted December 22, 2016 Script Isnt Working Anymore I guess Function names Have Changed a bit "_" here anyways got an idea of how its done Thanks Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 22, 2016 Moderators Share Posted December 22, 2016 @n3wbie yes, typically scripts written 11 years and two dozen releases ago don't work so well. You would be better served starting a new topic in Help and Support, explaining exactly what you are wanting to do, and showing what you have tried. You can even link to this post if this is the script you have been using it. n3wbie 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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