MikelSevrel Posted February 25, 2006 Share Posted February 25, 2006 This is the first section, that compiles as DubScheduler, this is where the command line properties need to be sent: expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> #include <Date.au3> #include <ini.au3> _defaults () $cap = " /capture /capchannel " $capdev = " /capdevice " $cmdlines = " /capfile " $capstart = "capstart " $command = GUICtrlRead($vdub) & $cap & $capdev & $cmdlines ; GUI GUICreate("VDub Capture Scheduler", 395, 340) GUICtrlCreateLabel("Channel Number", 12, 5, 150) GUICtrlCreateLabel("Days to Record", 202, 5, 150) GUICtrlCreateLabel("Program Title", 12, 40, 150) GUICtrlCreateLabel("Folder", 12, 75, 150) GUICtrlCreateLabel("Device Name", 12, 110, 150) GUICtrlCreateLabel("VDUB Location", 12, 145, 150) GUICtrlCreateLabel("Start Time (Example 7:00PM)", 12, 180, 150) GUICtrlCreateLabel("How Often?", 202, 145, 150) GUICtrlCreateLabel("Length in Minutes", 12, 215, 150) ; INPUT $now = @HOUR & ":" & @MIN & " " & @MDAY $channel = GUICtrlCreateInput($inivar[3][1], 10, 20, 180, 20) $title = GUICtrlCreateInput($inivar[2][1], 10, 55, 180, 20) $folder = GUICtrlCreateInput($inivar[4][1], 10, 90, 180, 20) $device = GUICtrlCreateInput($inivar[5][1], 10, 125, 180, 20) $vdub = GUICtrlCreateInput($inivar[1][1], 10, 160, 180, 20) $startime = GUICtrlCreateInput($inivar[7][1], 10, 195, 180, 20) $duration = GUICtrlCreateInput($inivar[6][1], 10, 230, 180, 20) $every = GUICtrlCreateListView("radio", 200, 160, 180, 35, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOCOLUMNHEADER, $LVS_REPORT)) _GUICtrlListViewSetColumnWidth ($every, 0, 175) GUICtrlSendMsg($every, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($every, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($every, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_SHOWSELALWAYS) GUICtrlCreateListViewItem("Weekly", $every) GUICtrlCreateListViewItem("Only For the Next Week", $every) GUISetState() $ListView = GUICtrlCreateListView("Day", 200, 20, 180, 125, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOCOLUMNHEADER, $LVS_REPORT)) _GUICtrlListViewSetColumnWidth ($ListView, 0, 175) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES) GUICtrlCreateListViewItem("Sunday", $ListView) GUICtrlCreateListViewItem("Monday", $ListView) GUICtrlCreateListViewItem("Tuesday", $ListView) GUICtrlCreateListViewItem("Wednesday", $ListView) GUICtrlCreateListViewItem("Thursday", $ListView) GUICtrlCreateListViewItem("Friday", $ListView) GUICtrlCreateListViewItem("Saturday", $ListView) GUISetState() $dates = StringSplit($inivar[8][1], ",") For $i = 0 To $dates[0] _SetDay($ListView, $dates[$i]) Next Func _SetDay(ByRef $lv_days, $t_input) Local $found_day = 0, $x For $x = 0 To _GUICtrlListViewGetItemCount ($lv_days) - 1 If StringInStr(StringUpper(_GUICtrlListViewGetItemText ($lv_days, $x, 0)), StringUpper($t_input)) Then GUICtrlSetState($lv_days, $GUI_FOCUS) _GUICtrlListViewSetCheckState ($lv_days, $x) $found_day = 1 ExitLoop EndIf Next EndFunc ;==>_SetDay ; ;For $i = 0 To $dates - 1 ; _GUICtrlListViewSetCheckState ($ListView, $i, 1) ;Next $schedule = GUICtrlCreateButton("Schedule", 3, 270, 180, 20) $cancel = GUICtrlCreateButton("Close", 200, 270, 180, 20) $ini = GUICtrlCreateButton("Save Settings", 3, 298, 380, 20) ; Script While 1 $msg = GUIGetMsg() Select Case $msg = $ini _IniWrite2 (@WorkingDir & "\schedule\default.ini") MsgBox(0, "Saved", "Defaults Saved") Case $msg = $schedule _Checked () _ini () MsgBox(0, "Schedule Saved", "Your Program Has Been Scheduled") $process = ProcessList("scheduler.exe") If $process = 1 Then Run(@WorkingDir & "\scheduler.exe") EndIf Case $msg = $cancel Or $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd The script to send the command: expandcollapse popup; Created by Mikel Sevrel ; mikelsevrel <AT> gmail.com #include <GUIConstants.au3> #include <GuiListView.au3> #include <Date.au3> #include <ini.au3> ; GUI GUICreate("VDub Schedule Manager", 380, 340) GUICtrlCreateLabel("Current Scheduled Tasks", 15, 5, 150, 15) ; INPUT $now = @HOUR & ":" & @MIN & " " & @MDAY _guiset() Func _guiset() $scheduled = GUICtrlCreateListView("scheduled|NIRE|Noy", 10, 20, 230, 280, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOCOLUMNHEADER, $LVS_REPORT)) GUICtrlSendMsg($scheduled, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($scheduled, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($scheduled, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_LIST, $LVS_LIST) $ininames = _FileListToArray(@WorkingDir & "\schedule", "schedule*.ini") If IsArray($ininames) Then For $i = 1 To $ininames[0] $section = IniReadSection(@WorkingDir & "\schedule\" & $ininames[$i], "Title") If IsArray($section) Then GUICtrlCreateListViewItem($section[2][1] & "|" & $section[7][1] & "|" & $section[6][1], $scheduled) Else EndIf Next Else EndIf EndFunc Func _ret() $viewitem = _GUICtrlListViewGetItemText($scheduled) $split = StringSplit($viewitem,"|") $id = _GUICtrlListViewGetCurSel($scheduled) EndFunc $New = GUICtrlCreateButton("New", 250, 20, 120, 20) $Modify = GUICtrlCreateButton("Edit", 250, 50, 120, 20) $Delete = GUICtrlCreateButton("Delete", 250, 80, 120, 20) GUISetState() While 1 Sleep(1) $msg = GUIGetMsg() Select Case $msg = $New RunWait(@WorkingDir & "\DubScheduler.exe") GUICtrlDelete ($scheduled) _guiset() Case $msg = $Delete _ret() $del = MsgBox(4, "Delete?", $section[10][1] & " - Will be deleted, are you sure?") If $del = 6 Then $del = $section[10][1] FileDelete($del) GUICtrlDelete ($scheduled) _guiset() EndIf Case $msg = $Modify _ret() $r2 = $section[9][1] RunWait(@WorkingDir & "\DubScheduler.exe """ & $r2 & """") GUICtrlDelete ($scheduled) _guiset() Case $msg = GUICtrlRead($var) Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd And the "ini.au3" include file expandcollapse popup; Created by Mikel Sevrel ; mikelsevrel <AT> gmail.com #include <Date.au3> #include <File.au3> #include <Array.au3> Dim $time, $title, $days, $now, $vdub, $folder, $device, $duration, $startime Dim $every, $command, $section, $i, $channel, $scheduled, $var, $ininames, $id Dim $split, $program, $ListView, $0, $1, $2, $3, $4, $5, $6, $7, $found_day, $t_input Dim $days, $Checked, $every, $is_Checked, $every2, $inivar Func _defaults() If $CmdLineRaw = 0 Then If FileExists(@WorkingDir & "\schedule\default.ini") = 1 Then $inivar = IniReadSection(@WorkingDir & "\schedule\default.ini", "Title") Else DirCreate("schedule") MsgBox(0, "", "Default Configuration File Created") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "vdub", "C:\Program Files\VirtualDub\virtualdub.exe") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "title", "Capture") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "channel", "31") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "folder", "C:\My Videos") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "device", "bt878") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "duration", "60") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "startime", "7:00PM") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "Dates", "Monday") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "Every", "weekly") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "FullLine", "C:\Program Files\VirtualDub\virtualdub.exe /capture /capchannel /capdevice /capfile") IniWrite(@WorkingDir & "\schedule\default.ini", "Title", "Path", """" & @WorkingDir & "\schedule\default.ini""") $inivar = IniReadSection(@WorkingDir & "\schedule\default.ini", "Title") EndIf Else $cmdline2 = $CmdLine[1] $inivar = IniReadSection($cmdline2, "Title") EndIf Return $inivar EndFunc Func _Checked() For $r = 0 To _GUICtrlListViewGetItemCount ($ListView) $Checked = _GUICtrlListViewGetCheckedState ($ListView, $r) If ($Checked <> $LV_ERR) Then If ($Checked) Then $days = $days & _GUICtrlListViewGetItemText ($ListView, $r) & "," EndIf Else MsgBox(0, "Uh-", "Oh") EndIf Next ;For $x = 0 To _GUICtrlListViewGetItemCount ($every) ; $is_Checked = _GUICtrlListViewGetCheckedState ($every, $x) ; If ($is_Checked <> $LV_ERR) Then ; If ($is_Checked) Then ; $every2 = $every2 & _GUICtrlListViewGetItemText ($every, $x) ; EndIf ; EndIf ; Next $every2 = GUICtrlRead(GUICtrlRead($every)) $days = StringTrimRight($days, 2); trim off the extra comma ; $every2 = StringTrimLeft($every2, 2) EndFunc ;==>_Checked Func _ConvertToMilTime($s_date) If StringUpper(StringMid($s_date, StringLen($s_date) - 1, 2)) = "PM" Then $s_date = StringSplit(StringTrimRight($s_date, 2), ":") If Number($s_date[1]) < 12 Then $s_date[1] = Number($s_date[1]) + 12 Else $s_date = StringSplit(StringTrimRight($s_date, 2), ":") If Number($s_date[1]) == 12 Then $s_date[1] = "0" EndIf Return StringFormat("%02d:%02d", $s_date[1], $s_date[2]) EndFunc ;==>_ConvertToMilTime Func _FileFunctions($t) $i = $t If FileExists(@WorkingDir & "\schedule\schedule" & GUICtrlRead($title) & $i & ".ini") Then _FileFunctions($i + 1) Else _IniWrite2(@WorkingDir & "\schedule\schedule" & GUICtrlRead($title) & $i & ".ini") EndIf EndFunc ;==>_FileFunctions Func _ini() If $CmdLine[0] <> 0 Then _IniWrite2($CmdLine) Else $name = _FileListToArray (@WorkingDir & "\schedule", "schedule" & GUICtrlRead($title) & "*.ini") If IsArray($name) Then _FileFunctions(1) Else $i = 1 If FileExists(@WorkingDir & "\schedule\schedule" & GUICtrlRead($title) & $i & ".ini") Then _FileFunctions(1) Else _IniWrite2(@WorkingDir & "\schedule\schedule" & GUICtrlRead($title) & $i & ".ini") EndIf EndIf EndIf EndFunc ;==>_ini Func _IniWrite2($path) IniWrite($path, "Title", "vdub", GUICtrlRead($vdub)) IniWrite($path, "Title", "title", GUICtrlRead($title)) IniWrite($path, "Title", "channel", GUICtrlRead($channel)) IniWrite($path, "Title", "folder", GUICtrlRead($folder)) IniWrite($path, "Title", "device", GUICtrlRead($device)) IniWrite($path, "Title", "duration", GUICtrlRead($duration)) IniWrite($path, "Title", "startime", _ConvertToMilTime(GUICtrlRead($startime))) IniWrite($path, "Title", "Dates", $days) IniWrite($path, "Title", "Every", $every2) IniWrite($path, "Title", "FullLine", GUICtrlRead($vdub) & " /capture /capchannel " & GUICtrlRead($channel) & " /capdevice " & GUICtrlRead($device) & " /capfile """ & GUICtrlRead($folder) & "\" & GUICtrlRead($title) & @MDAY & ".avi"" /capstart " & GUICtrlRead($duration)) IniWrite($path, "Title", "FileName", $path) IniWrite($path, "Title", "Path", """" & $inivar[10][1] & """") EndFunc ;==>_IniWrite2 Coming soon.... 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