I'll attach the file here.
Note: this is an adaptation of an ancient bash file for a "file per todo
system" I used to use, and I honestly am not totally sure of the logic of
everything in it.
The only comment I added now was the one about the date format for TW.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/6d2c4db8-0f50-4486-ac4c-339297801b45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#! /bin/bash
#script to quicklywrite down a note & save to a text file using first line as title, by Dave Parker
# /home/david/Dropbox/scripts/yad/newNote.sh
PARG=$@
[[ $PARG = "" ]] && PARG=""
cr="
"
[[ $PARG == ..* ]] && PARG2="${cr}${PARG}"
[[ $PARG == ..* ]] && PARG=$PARG2
echo """$PARG""" > /tmp/testnotes2.txt
echo "" > /tmp/duedate.txt
filepath="/home/david/SyncthingFolders/Bob/TiddlyWiki5/Wikis/BobWiki/tiddlers/"
filepath2="/home/david/SyncthingFolders/Bob/TiddlyWiki5/Wikis/BobWiki/"
if [ ! -d "$filepath" ]; then
echo no plug-in path here
filepath="/home/david/SyncthingFolders/Bob/IndexWiki/tiddlers/"
filepath2="/home/david/SyncthingFolders/Bob/IndexWiki/"
fi
scriptpath="/home/david/Dropbox/scripts/"
if [ ! -d "$scriptpath" ]; then
echo no dropbox path here
scriptpath="/home/david/SyncthingFolders/allScripts/"
fi
date=`date "+%Y%0m%0d"`
longdate=`date -u "+%Y%m%d%H%M%5N"`; # <-- this is important for getting the TW date format right
marker=""
yad --text="new note" --timeout=1 &
${scriptpath}bash/bringAbove.sh "NewTiddler" "home" &
echo $PARG | yad --text-info --show-uri --back=#456787 --fore=white --always-print-result --width=600 --height=500 --center --wrap --name="NewTiddler" --window-icon="text-editor" --title=$"NewTiddler" --button="gtk-save:0" --button="gtk-open:2" --button="gtk-close:1" --editable --filename=/tmp/testnotes2.txt > /tmp/testnotes.txt
marker=`echo $?`
cat /tmp/testnotes.txt > /tmp/append.txt
echo the marker is $marker
if [[ $marker -eq 0 ]]
then
#get first line of file for name
firstline=`head -1 /tmp/testnotes.txt`
firstline2=`echo $firstline | awk '{gsub(/:/,".");print}'`
#put name onto path of where you store your notes
fullname="${filepath}$firstline2.tid" && ENAME="[[$firstline]]"
if [ -e """$fullname""" ]
then
echo "$cr------------------$date : $cr" > /tmp/append.txt
cat /tmp/testnotes.txt >> /tmp/append.txt
fi
cat /tmp/append.txt >> """$fullname"""
echo where? : """$fullname"""
fi
#get the word "title:" added to the beginning of first line
sed -i '1s/^/title: /' """$fullname"""
#add due date if it exists
FILE=/tmp/duedate.txt
if grep -q due "$FILE"; then myduedate=$(cat /tmp/duedate.txt); sed -i "1i${myduedate}" """$fullname""";fi
sleep 1
sed -i "1icreated: ${longdate}" """$fullname"""
sleep 1
sed -i "1imodified: ${longdate}" """$fullname"""
if [[ $marker -eq 2 ]]
then
#wmctrl -k on
mousepad """$fullname""" || gedit """$fullname"""
sleep 1
wmctrl -a """$fullname""" && xdotool search """$fullname""" windowactivate &
wmctrl -r :"""$fullname""" -b remove,maximized_vert; wmctrl -r """$fullname""" -b remove,maximized_horz; wmctrl -r """$fullname""" -e 0,700,240,400,400
bash ${scriptpath}bash/bringAboveCentered.sh
fi