-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddTodo.ps1
More file actions
34 lines (31 loc) · 806 Bytes
/
Copy pathAddTodo.ps1
File metadata and controls
34 lines (31 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$command = $args[0]
$param = $args[1]
$xml = New-Object XML
$xml.Load("C:\Users\adamc.UNITYMG\Documents\Rainmeter\Skins\SimpleMeter_v2.0\Notes\Notes\Notes.txt")
if($command -eq 'add')
{
$xml.Todo.Notes = $xml.Todo.Notes +"- " +$param+ "`r`n"
}
if($command -eq 'rm')
{
$param = [int]$param
$note = [string]$xml.Todo.Notes
$note = $note.replace("`r","")
$note = $note.replace("`n","")
$notes = $note.split("-")
$result = ""
for($i=1; $i -le $notes.Length - 1; $i++)
{
if($i -eq ($param))
{
./addDone.ps1 add $notes[$i].Trim()
#$result = $result +"- " +$notes[$i].Trim() + "`r`n"
}
else
{
$result = $result +"- " +$notes[$i].Trim() + "`r`n"
}
}
$xml.Todo.Notes = $result
}
$xml.Save("C:\Users\adamc.UNITYMG\Documents\Rainmeter\Skins\SimpleMeter_v2.0\Notes\Notes\Notes.txt")