Mintz Posted February 10, 2008 Share Posted February 10, 2008 (edited) hey, i was working on a task manager (not windows task manager, like an outlook task manager) type program. Its still really patchy but i got somethings working... Anyway i'm having a few problems with a self made function i created, i created it to allow for many tasks insted of me just coding for say 20 and say "You cannot have more than 20 tasks" Heres the script: (theres something up with the autoit tags?) expandcollapse popup#include<GUIconstants.au3> #include<File.au3> $main = GUICreate("Task Manager", 500, 200) Global $ListView = GUICtrlCreateListView("Task |Due Date |Priority", 0, 0, 300) $newtaskbutton = GUICtrlCreateButton("New Task", 10, 160, 90) $taskdonebutton = GUICtrlCreateButton("Done!", 200, 160, 90) $Taskedit = GUICtrlCreateButton("Edit Task", 105, 160, 90) global $NoteView = GUICtrlCreateEdit("Task Notes...", 300, 0, 200, 200,$ES_READONLY) $newtask = GUICreate("New Task", 500, 500) $Tasktitle = GUICtrlCreateInput("", 50, 5, 300) GUICtrlCreateLabel("Title:", 10, 10) GUICtrlCreateLabel("Due Date: ", 10, 35) $low_p = GUICtrlCreateRadio("Low ", 250, 30) $Normal_p = GUICtrlCreateRadio("Normal ", 300, 30) GUICtrlSetState($Normal_p, $GUI_CHECKED) $high_p = GUICtrlCreateRadio("High ", 365, 30) GUICtrlCreateLabel("Prioirty: ", 200, 35) global $notes = GUICtrlCreateEdit("Notes...",0,100, 500, 400) $save_close = GUICtrlCreateButton("Save and Close", 10, 60, 100) $save = GUICtrlCreateButton("Save", 150, 60, 100) $due = GUICtrlCreateCombo(@MDAY&"-"&@MON&"-"&@YEAR, 80, 30, 100) $i = 1 $day = 0 $month = @MON global $x = IniRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "total", "total", "0") Switch $Month case 9 to 10, 4, 6 while $Day <= 30 GUICtrlSetData(-1, @MDAY+$i&"-"&@MON&"-"&@YEAR, $Due) $i = $i+1 $day = @MDAY+$i WEnd Case 2 while $Day <= 28 GUICtrlSetData(-1, @MDAY+$i&"-"&@MON&"-"&@YEAR, $Due) $i = $i+1 $day = @MDAY+$i WEnd case Else while $Day <= 31 GUICtrlSetData(-1, @MDAY+$i&"-"&@MON&"-"&@YEAR, $Due) $i = $i+1 $day = @MDAY+$i WEnd EndSwitch GUISetState(@SW_SHOW, $Main) While 1 $Read = GUIctrlread($listview) - 3 ;--------------------the problem lies here i think--------------------------- getnotes($read) $msg = GUIGetMsg() Select case $msg = $newtaskbutton GUISetstate(@SW_SHOW, $newtask) case $msg = $taskedit MsgBox(0, "Test", GUictrlread($listview)) case $msg = $Save_close if GUICtrlRead($Low_p) = $GUI_CHECKED Then tasksave(GUIctrlread($tasktitle), GUIctrlread($due), "low") elseif GUICtrlRead($normal_p) = $GUI_CHECKED Then tasksave(GUIctrlread($tasktitle), GUIctrlread($due), "Normal") elseif GUICtrlRead($high_p) = $GUI_CHECKED Then tasksave(GUIctrlread($tasktitle), GUIctrlread($Due), "High") EndIf case $msg = $GUI_EVENT_CLOSE and BitAND(WinActive("New Task"), 1) = 1 GUISetState(@SW_HIDE, $Newtask) GUICtrlSetData($notes, "Notes...") GUICtrlSetData($tasktitle, "") GUICtrlSetState($normal_p, $GUI_CHECKED) case $msg = $GUI_EVENT_CLOSE IniWrite("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "total", "total", $x) Exit EndSelect WEnd func tasksave($title, $date, $priority) IniWrite("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "titles", $x, $title) _filecreate("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".ini") local $iniwrite[3][2] = [ ["title", $title ], [ "date", $date], ["priority", $priority] ] IniWriteSection("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".ini", "Settings", $iniwrite) $notes2 = GUICtrlRead($notes) _filecreate("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt") filewrite("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt", $notes2) GUISetState(@SW_HIDE, $Newtask) GUICtrlSetData($notes, "Notes...") GUICtrlSetData($tasktitle, "") GUICtrlSetState($normal_p, $GUI_CHECKED) GUICtrlCreateListViewItem($title&"|"&$date&"|"&$priority, $listview) global $x = $x + 1 EndFunc func getnotes($number) if $number = 0 Then return 0 EndIf $TITLE = IniRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "title", $number , "error") $notes = FileRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt") GUICtrlSetData($noteview, $notes) EndFunc My settings.ini File reads: [Total] total=0 [Titles] Or filled in [Total] total=2 [Titles] 0=task1 1=task2 2=task3 Well my getnotes function is not working as i would have hoped for and i cant seem to figure out whats happening... This program is no where near done, but i would like this problem solved before i move on Thanks in advance. Edited February 10, 2008 by Mintz Link to comment Share on other sites More sharing options...
Uten Posted February 10, 2008 Share Posted February 10, 2008 Well my getnotes function is not working as i would have hoped for and i cant seem to figure out whats happening...What did you expect and what did it return? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Mintz Posted February 10, 2008 Author Share Posted February 10, 2008 expandcollapse popup#include<GUIconstants.au3> #include<File.au3> $main = GUICreate("Task Manager", 500, 200) Global $ListView = GUICtrlCreateListView("Task |Due Date |Priority", 0, 0, 300) $newtaskbutton = GUICtrlCreateButton("New Task", 10, 160, 90) $taskdonebutton = GUICtrlCreateButton("Done!", 200, 160, 90) $Taskedit = GUICtrlCreateButton("Edit Task", 105, 160, 90) global $NoteView = GUICtrlCreateEdit("Task Notes...", 300, 0, 200, 200,$ES_READONLY) $newtask = GUICreate("New Task", 500, 500) $Tasktitle = GUICtrlCreateInput("", 50, 5, 300) GUICtrlCreateLabel("Title:", 10, 10) GUICtrlCreateLabel("Due Date: ", 10, 35) $low_p = GUICtrlCreateRadio("Low ", 250, 30) $Normal_p = GUICtrlCreateRadio("Normal ", 300, 30) GUICtrlSetState($Normal_p, $GUI_CHECKED) $high_p = GUICtrlCreateRadio("High ", 365, 30) GUICtrlCreateLabel("Prioirty: ", 200, 35) global $notes = GUICtrlCreateEdit("Notes...",0,100, 500, 400) $save_close = GUICtrlCreateButton("Save and Close", 10, 60, 100) $save = GUICtrlCreateButton("Save", 150, 60, 100) $due = GUICtrlCreateCombo(@MDAY&"-"&@MON&"-"&@YEAR, 80, 30, 100) $i = 1 $day = 0 $month = @MON global $x = IniRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "total", "total", "0") Switch $Month case 9 to 10, 4, 6 while $Day <= 30 GUICtrlSetData(-1, @MDAY+$i&"-"&@MON&"-"&@YEAR, $Due) $i = $i+1 $day = @MDAY+$i WEnd Case 2 while $Day <= 28 GUICtrlSetData(-1, @MDAY+$i&"-"&@MON&"-"&@YEAR, $Due) $i = $i+1 $day = @MDAY+$i WEnd case Else while $Day <= 31 GUICtrlSetData(-1, @MDAY+$i&"-"&@MON&"-"&@YEAR, $Due) $i = $i+1 $day = @MDAY+$i WEnd EndSwitch GUISetState(@SW_SHOW, $Main) While 1 $Read = GUIctrlread($listview) - 3 $write = getnotes($read) GUICtrlSetData($noteview, $write) $msg = GUIGetMsg() Select case $msg = $newtaskbutton GUISetstate(@SW_SHOW, $newtask) GUICtrlSetData($notes, "Notes...") case $msg = $taskedit MsgBox(0, "Test", GUictrlread($listview)) case $msg = $Save_close if GUICtrlRead($Low_p) = $GUI_CHECKED Then tasksaveclose(GUIctrlread($tasktitle), GUIctrlread($due), "low") elseif GUICtrlRead($normal_p) = $GUI_CHECKED Then tasksaveclose(GUIctrlread($tasktitle), GUIctrlread($due), "Normal") elseif GUICtrlRead($high_p) = $GUI_CHECKED Then tasksaveclose(GUIctrlread($tasktitle), GUIctrlread($Due), "High") EndIf case $msg = $GUI_EVENT_CLOSE and BitAND(WinActive("New Task"), 1) = 1 GUISetState(@SW_HIDE, $Newtask) GUICtrlSetData($notes, "Notes...") GUICtrlSetData($tasktitle, "") GUICtrlSetState($normal_p, $GUI_CHECKED) case $msg = $GUI_EVENT_CLOSE IniWrite("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "total", "total", $x) Exit EndSelect WEnd func tasksaveclose($title, $date, $priority) IniWrite("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "titles", $x, $title) _filecreate("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".ini") local $iniwrite[3][2] = [ ["title", $title ], [ "date", $date], ["priority", $priority] ] IniWriteSection("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".ini", "Settings", $iniwrite) $notes2 = GUICtrlRead($notes) _filecreate("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt") filewrite("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt", $notes2) GUISetState(@SW_HIDE, $Newtask) GUICtrlSetData($notes, "Notes...") GUICtrlSetData($tasktitle, "") GUICtrlSetState($normal_p, $GUI_CHECKED) GUICtrlCreateListViewItem($title&"|"&$date&"|"&$priority, $listview) global $x = $x + 1 EndFunc func getnotes($number) if $number = 0 Then return 0 Else $TITLE = IniRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "title", $number , "1") $notes2 = FileRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt") return $notes2 EndIf Updated the code but it still doesn't work i wanted it to display the notes of the task selected in the notes box to the right.... Link to comment Share on other sites More sharing options...
Uten Posted February 10, 2008 Share Posted February 10, 2008 What did you expect and what did it return? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Mintz Posted February 11, 2008 Author Share Posted February 11, 2008 i didnt need it to return anything, it should change the value of $noteview right? i changed it a bit to return the reading of the .txt file associated... but it still didnt work func getnotes($number) if $number = 0 Then return 0 Else $TITLE = IniRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "title", $number , "1") $notes2 = FileRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt") return $notes2 EndIf EndFuncoÝ÷ Ùæ«'«¯y«¢+Ø]¡¥±Ä$(ÀÌØíIôU%ÑÉ±É ÀÌØí±¥ÍÑ٥ܤ´Ì($ÀÌØíÝÉ¥Ñôѹ½ÑÌ ÀÌØíɤ(%U% ÑɱMÑÑ ÀÌØí¹½Ñ٥ܰÀÌØíÝɥѤ($ÀÌØíµÍôU%Ñ5Í ¤(M±Ð)Ѹ¸¸oÝ÷ Ø_»-jëh×6func getnotes($number) if $number = 0 Then return 0 EndIf $TITLE = IniRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\settings.ini", "title", $number , "1") $notes2 = FileRead("C:\Documents and Settings\Default User\Local Settings\Application Data\Tasks\"&$title&".txt") GUICtrlSetData($noteview, $notes2) EndFunc 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