View Single Post
Aranel's Avatar
Posts: 301 | Thanked: 227 times | Joined on Nov 2009 @ Turkey
#35
I wrote a very simple script, to cheat (in exams/work/life). Well, It's a script to print text on your watch. I don't need it much nowadays but I guess It's a must-have for students :P

Create a file named owcheater.sh and owcheater, fill it up with entries, like:

iamcheating iamcheatingg
rainbows11rainbows22rainbows33rainbows44 99999
END END
You can run it via "sh owcheater.sh" command.
owcheater.sh file:

# OW-Cheater Script by Aranel Surion @ 29 Nov 2010
# Works on Nokia N900 (Maemo 5) with proper OpenWatch installation.

# Envelope dbus signal
dbus-send --session --print-reply --dest=com.smartmadsoft.openwatch /com/smartmadsoft/openwatch com.smartmadsoft.openwatch.envelope
sleep 1
# Main While
while :
do
# First-run Header entry
dbus-send --session --print-reply --dest=com.smartmadsoft.openwatch /com/smartmadsoft/openwatch com.smartmadsoft.openwatch.send1line string:'Your Name Goes Here'
sleep 3
# Read While
while read -r line line2
do
# Debug Mode (argument: --debug)
if [ "$1" = "--debug" ]; then
echo "[DBUS Send] Message: $line - $line2 (strlen: ${#line} ${#line2})"
fi
# DBUS Message Signal
dbus-send --session --print-reply --dest=com.smartmadsoft.openwatch /com/smartmadsoft/openwatch com.smartmadsoft.openwatch.send2lines string:$line string:$line2

# Sleep Timing for First Line
if [ "${#line}" -le 18 ]; then
UYKU=4
elif [ "${#line}" -gt 18 ] && [ "${#line}" -le 25 ]; then
UYKU=8
elif [ "${#line}" -gt 25 ] && [ "${#line}" -le 30 ]; then
UYKU=10
elif [ "${#line}" -gt 30 ] && [ "${#line}" -le 40 ]; then
UYKU=11
elif [ "${#line}" -gt 40 ]; then
UYKU=12
fi

# Sleep Timing for Second Line
# --> FL check.
if [ "${#line2}" -le 18 ] && [ "$UYKU" -le 4 ]; then
UYKU=4
elif [ "${#line2}" -gt 18 ] && [ "${#line2}" -le 25 ] && [ "$UYKU" -le 8 ]; then
UYKU=8
elif [ "${#line2}" -gt 25 ] && [ "${#line2}" -le 30 ] && [ "$UYKU" -le 10 ]; then
UYKU=10
elif [ "${#line2}" -gt 30 ] && [ "${#line2}" -le 40 ] && [ "$UYKU" -le 11 ]; then
UYKU=11
elif [ "${#line2}" -gt 40 ] && [ "$UYKU" -le 12 ]; then
UYKU=12
fi

# Sleep
sleep $UYKU

done < "owcheater"
done
Note: You should not exceed 40 characters per line or it won't show up correctly. It's a limitation of watch itself.