dexter Posted December 29, 2009 Share Posted December 29, 2009 Hi ! I have been working on a task scheduling software, and at this point I need to incorporate this feature that will show all scheduled tasks ( or .job files in the tasks directory of windows) and the user can click on the task to be deleted and it is deleted. It will be more useful if the time when the task is scheduled to be run is also displayed. Please help me out. Link to comment Share on other sites More sharing options...
darkjohn20 Posted December 29, 2009 Share Posted December 29, 2009 Store all of the info in a text file, and then read each line. When the user presses delete, take out that line. If your line was: Task Time then you could split the string with " " to get the task and time separated. Link to comment Share on other sites More sharing options...
dexter Posted December 29, 2009 Author Share Posted December 29, 2009 Ok ... I made my program to add an entry in an ini file each time a task was created ... But how can I display all entries of this ini file in a window, where in I can select the task to be deleted by clicking on it ? Link to comment Share on other sites More sharing options...
99ojo Posted December 29, 2009 Share Posted December 29, 2009 (edited) Hi,I made my program to add an entry in an ini fileSo make a program reading out the ini.There are many ways to display items:1) You may fill a combobox with the names of the task.2) You may use a listview.For deletion create a 'Delete' button with apropriate action code.For further assistence you should post some code and the structure of your ini file.;-))Stefan Edited December 29, 2009 by 99ojo Link to comment Share on other sites More sharing options...
dexter Posted December 30, 2009 Author Share Posted December 30, 2009 Hi ! This is the function I am trying to make to read out the ini and display it as a list, so that a entry can be selected and can be deleted. I am new to programing, plz bear with my errors expandcollapse popupfunc tasks() local $a, $ok, $cancel,$msg, $list1 GUISetState(@SW_HIDE, $main) GUICreate("Delete Old Tasks", 400, 300) GUIsetIcon(@WindowsDir & "\alarm.ico",0) $filemenu = GUICtrlCreateMenu("&Help") $fileitem = GUICtrlCreateMenuItem("Open help file", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $url = GUICtrlCreateMenuItem("Open Support page", $filemenu) $about = GUICtrlCreateMenuItem("About", $filemenu) $ok = GUICtrlCreateButton("Delete",60,235,120,20) $cancel = GUICtrlCreateButton("Cancel",220,235,120,20) $List1 = GUICtrlCreateListView("Taskname" &"|" & "Time", 50, 24, 300, 200) ; GUISetState() $list1 = IniReadSection(@WindowsDir&"\tasks.ini","task") While 1 GUICtrlCreateListViewItem("check", $List1) $msg = GUIGetMsg() select case $msg = $GUI_EVENT_CLOSE Exit case $msg = $ok ExitLoop case $msg = $cancel ExitLoop case $msg = $fileitem call("help") case $msg = $url call("site") case $msg = $about msgbox(262144,"About","Auto-connect Download scheduler V 2.4 - By: Aijaz") EndSelect WEnd GUIDelete() call("choose") EndFunc Plz let me have a working code . Thanks ! Link to comment Share on other sites More sharing options...
99ojo Posted December 30, 2009 Share Posted December 30, 2009 Hi, you missed to post more code and post your ini file structure. So i will post also some snippets fore you: Tasks.ini structure: [task] taskname=test|9:30 taskname=test1|19:30 expandcollapse popup#include <GUIConstantsEx.au3> #include <array.au3> #Include <GuiListView.au3> tasks () func tasks() local $a, $ok, $cancel,$msg, $artaskini GUISetState(@SW_HIDE, $main) GUICreate("Delete Old Tasks", 400, 300) GUIsetIcon(@WindowsDir & "\alarm.ico",0) $filemenu = GUICtrlCreateMenu("&Help") $fileitem = GUICtrlCreateMenuItem("Open help file", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $url = GUICtrlCreateMenuItem("Open Support page", $filemenu) $about = GUICtrlCreateMenuItem("About", $filemenu) $ok = GUICtrlCreateButton("Delete",60,235,120,20) $cancel = GUICtrlCreateButton("Cancel",220,235,120,20) $List1 = GUICtrlCreateListView("Taskname" &"|" & "Time", 50, 24, 300, 200) ; GUISetState() ;reading ini into array $listini = IniReadSection(@WindowsDir&"\tasks.ini","task") ;filling listview with ini values, more information see helpfile Return from IniReadSection For $i = 1 To UBound ($listini) - 1 GUICtrlCreateListViewItem($listini [$i] [1] , $List1) Next While 1 $msg = GUIGetMsg() select case $msg = $GUI_EVENT_CLOSE Exit case $msg = $ok ;get index of 1 st selected listviewitem, no multi selection, no error control, you have to code by yourself ;see helpfile return of _GUICtrlListView_GetSelectedIndices $select = _GUICtrlListView_GetSelectedIndices ($List1, True) ;get text of selected listviewitem $string = _GUICtrlListView_GetItemText ($List1, $select [1]) ;loop over IniReadSection array For $i = 1 To UBound ($listini) - 1 ;find listviewitem in array If StringInStr ($listini [$i] [1], $string) Then ;delete from array _Arraydelete ($listini, $i) ExitLoop EndIf Next ;open ini file in overwrite mode $file = FileOpen (@WindowsDir&"\tasks.ini", 2) ;1st line is section FileWriteLine ($file, "[task]") For $i = 1 To UBound ($listini) - 1 ;next lines are values from IniReadSection array FileWriteLine ($file, $listini [$i] [0] & "=" & $listini [$i] [1]) Next ;close file FileClose ($file) ;have a look at ini file ShellExecute (@WindowsDir&"\tasks.ini") ExitLoop case $msg = $cancel ExitLoop case $msg = $fileitem call("help") case $msg = $url call("site") case $msg = $about msgbox(262144,"About","Auto-connect Download scheduler V 2.4 - By: Aijaz") EndSelect WEnd GUIDelete() EndFunc ;-)) Stefan Link to comment Share on other sites More sharing options...
dexter Posted December 30, 2009 Author Share Posted December 30, 2009 Hi Stefan ... Thanks a lot .. The code worked like charm ... I can directly put it in after a little minor alterations ... thanks a lot again ... You made my day !! 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