Welcome, guest | Sign In | My Account | Store | Cart

Script that rewrites a to-do list on the Windows Active Desktop and then refreshes the display.

Python, 78 lines
 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
todayFile = file ( 'today.htm', 'w' )

print >> todayFile, '<!-- DO NOT edit this file, edit the following file \nJ:\\outlines\\today.py\n -->'

tables = {

'1 Today': """\
basement mold
squirrels
check libraries
security lights
rethink Internet configuration
PBS Price Pottenger Rae
auto search Hamilton career web sites
Salvation Army form
report to Giammarco
call about DVD warranty
free career counselling to selected candidates
resume to Carole Martin (see ad from HRDC software)
tweezers
""",

'5 Home Depot': """\
clamp for motor
trenching tool
""",

'2 Giant Tiger':"""\
chewies
1/2 &amp; 1/2
dye
""",

'4 Hagersville': """\
""",

'3 Groceries': """\
""",

'6 Libraries': """\
Alexander Fullerton
Champagne Navy
mystery novels
Barbara Hardy: London Lovers
John Buxton Hilton: Displaced Person
Patricia Duncker: Monsieur Shoushana's Lemon Trees
Klemperer (Cohen)
""",

'7 Hamilton': """\
water filter
""",

}

from string import split

for table in tables :
    print >> todayFile, '<table width="100%" cellspacing="5">'
    print >> todayFile, '<tr><th colspan="3" align="center">%s</th></tr>' % table
    items = [ item for item in split ( tables [ table ], '\n' ) if item ] + 3 * [ '-' ]
    for start in range ( 0, len ( items ), 3 ) :
        if items [ start ] != '-' :
            print >> todayFile, '<tr>',
            for item in items [ start : start + 3 ] :
                print >> todayFile, '<td>%s</td>' % item
        print >> todayFile, '</tr>'
    print >> todayFile, '</table>'
    
todayFile . close ( )

from win32com.shell.shellcon import *
from win32com.shell import shell

# SHChangeNotify should, I understand, be content with None in each of the final two arguments
# However, since it's not ...
lpil = shell . SHGetSpecialFolderLocation ( 0, CSIDL_DESKTOP )
shell . SHChangeNotify ( SHCNE_ASSOCCHANGED, SHCNF_IDLIST, lpil, lpil )

The script makes it easy to keep an up-to-date list of tasks right on the Windows desktop.

Update the data structure with your own structured collections of tasks to perform, choose a suitable filename for the storage of the script's output HTML file, put the full path of the place where you store the script in the fourth line of the script (suitably formatted) and then run the script for the first time. Now, with Active Desktop activated, arrange to display the script's output HTML on your desktop.

When you next need to update your task list, right click on the list display, view the source, and display the script file, using its name as listed in the HTML. Modify your tasks list as necessary, run the script and your updated lists should be present on your screen.

1 comment

Alexander Semenov 16 years, 7 months ago  # | flag

it is interesting to find way to refresh desktop for another user (e.g. change currently logged user desktop from background admin task), or, more interesting, to force desktop refresh from network