Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Saturday, February 12, 2005

Yay - My First Pocket PC Python Script


import os
import shutil

for file in filter(lambda x: x.endswith("lnk"), os.listdir("/Launcher")):
os.unlink("/Launcher/"+file)

for file in filter(lambda x: x.endswith("lnk"), os.listdir("/Windows/Start Menu\Programs")):
shutil.copy("/Windows/Start Menu/Programs/"+file, "/Launcher")


The Python script above copies the shortcuts in my Programs directory into my Launcher directory, thus updating the programs displayed in my Today-screen launcher (see below).



I'm using Scott Seligman's Launcher because it is simply configured using shortcuts in a directory, enabling me to do stuff like this script.

To run the script, you use the following command inside Pocket Python:

execfile("/My Documents/UpdateLauncher.py")

0 Comments:

Post a Comment

<< Home