diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/Convert DOC to PDF b/Scripts/Nautilus/Convert DOC to PDF
new file mode 100755
index 0000000..641caf3
--- /dev/null
+++ b/Scripts/Nautilus/Convert DOC to PDF
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo Installing document conversions macro
+~/Code/code/Scripts/installOpenOfficeMacro.sh ~/Code/code/Scripts/conversions.bas
+echo Installed document conversions macro
+
+IFS='
+'
+fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+for file in $fpaths
+do
+ if [ -f "$file" ]; then
+ base=${file%.*}
+ ext=${file##*.}
+ if [[ ( ( "$ext" == "ODT" ) || ( "$ext" == "odt" ) ) || ( ( "$ext" == "DOC" ) || ( "$ext" == "doc" ) ) ]]; then
+ ~/Code/code/Scripts/convertToPDF.sh "$file" "$base.pdf"
+ fi
+ fi
+done
+
+
diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/Convert DOC to PDF b/Scripts/Nautilus/Convert DOC to PDF
new file mode 100755
index 0000000..641caf3
--- /dev/null
+++ b/Scripts/Nautilus/Convert DOC to PDF
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo Installing document conversions macro
+~/Code/code/Scripts/installOpenOfficeMacro.sh ~/Code/code/Scripts/conversions.bas
+echo Installed document conversions macro
+
+IFS='
+'
+fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+for file in $fpaths
+do
+ if [ -f "$file" ]; then
+ base=${file%.*}
+ ext=${file##*.}
+ if [[ ( ( "$ext" == "ODT" ) || ( "$ext" == "odt" ) ) || ( ( "$ext" == "DOC" ) || ( "$ext" == "doc" ) ) ]]; then
+ ~/Code/code/Scripts/convertToPDF.sh "$file" "$base.pdf"
+ fi
+ fi
+done
+
+
diff --git a/Scripts/Nautilus/Email File b/Scripts/Nautilus/Email File
new file mode 100755
index 0000000..1580de9
--- /dev/null
+++ b/Scripts/Nautilus/Email File
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+IFS='
+'
+MAIL=/usr/bin/mail
+SUBJECT="See attached file(s)"
+ATTACHMENT_FILES=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+MAIL_DOMAIN=`cat /etc/mailname`
+DEFAULT_EMAIL_ADDRESS=$USERNAME@$MAIL_DOMAIN
+FULL_NAME=`cat /etc/passwd | grep $USERNAME | cut -d ":" -f5 | cut -d "," -f1`
+EMAIL_MESSAGE="
+Please find the attached file(s).
+
+--
+Kind regards
+$FULL_NAME
+
+"
+DEST_MAIL_ADDR=`~/.gnome2/nautilus-scripts/.prompt-output.py "Email To:" "$DEFAULT_EMAIL_ADDRESS"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+USER_STR=`echo $DEFAULT_EMAIL_ADDRESS | base64`
+PASSWORD=`~/.gnome2/nautilus-scripts/.prompt-output.py "Enter password for $FULL_NAME <$DEFAULT_EMAIL_ADDRESS>:" "password"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+PASSWORD=`echo $PASSWORD | base64`
+
+cat > /tmp/tmp-message.bin << EOF
+EHLO $MAIL_DOMAIN
+AUTH LOGIN
+$USER_STR
+$PASSWORD
+MAIL FROM:$DEFAULT_EMAIL_ADDRESS
+RCPT TO:$DEST_MAIL_ADDR
+DATA
+From: "$FULL_NAME" <$DEFAULT_EMAIL_ADDRESS>
+To: <$DEST_MAIL_ADDR>
+Subject: $SUBJECT
+Content-Type: multipart/mixed; boundary="ARandomStringThatOnlyThisProgramWouldEverUse"
+MIME-Verion: 1.0
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Transfer-Encoding: quoted-printable
+Content-type: text/plain
+
+$EMAIL_MESSAGE
+
+EOF
+# echo -e $EMAIL_MESSAGE > /tmp/desc
+for FILE in ${ATTACHMENT_FILES}
+do
+ if [ -f "$FILE" ]; then
+ # mpack -a -s $SUBJECT -d /tmp/desc $FILE $DEST_MAIL_ADDR
+ BASE=`basename $FILE`
+ EXT=${FILE##*.}
+ MIME=`egrep "( | )$EXT( |$)" /etc/mime.types | cut -d ' ' -f 1`
+ [ "$MIME" == "" ] && MIME="application/octet-stream"
+ cat >> /tmp/tmp-message.bin << EOF
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Type: $MIME; name="$BASE"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="$BASE"
+
+EOF
+ base64 "$FILE" >> /tmp/tmp-message.bin
+ fi
+done
+echo "" >> /tmp/tmp-message.bin
+echo "--ARandomStringThatOnlyThisProgramWouldEverUse--" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "Some extra hidden text" >> /tmp/tmp-message.bin
+echo "Testing if this is seen or how it is handled" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "." >> /tmp/tmp-message.bin
+echo "QUIT" >> /tmp/tmp-message.bin
+
+
+#mime-construct --to ${DEST_MAIL_ADDR} --subject ${SUBJECT} --string ${EMAIL_MESSAGE} ${ARGS} --output --debug
+# $MAIL $DEST_MAIL_ADDR < /tmp/tmp-message.bin
+nc mail.$MAIL_DOMAIN 25 < /tmp/tmp-message.bin > /tmp/out
+rm -rf /tmp/tmp-message.bin
+
+OUTPUT=`cat /tmp/out | tail -n 2`
+
+~/.gnome2/nautilus-scripts/.done.py "Sent files to \"${DEST_MAIL_ADDR}\".
+
+Result:
+$OUTPUT
+"
+
+
diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/Convert DOC to PDF b/Scripts/Nautilus/Convert DOC to PDF
new file mode 100755
index 0000000..641caf3
--- /dev/null
+++ b/Scripts/Nautilus/Convert DOC to PDF
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo Installing document conversions macro
+~/Code/code/Scripts/installOpenOfficeMacro.sh ~/Code/code/Scripts/conversions.bas
+echo Installed document conversions macro
+
+IFS='
+'
+fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+for file in $fpaths
+do
+ if [ -f "$file" ]; then
+ base=${file%.*}
+ ext=${file##*.}
+ if [[ ( ( "$ext" == "ODT" ) || ( "$ext" == "odt" ) ) || ( ( "$ext" == "DOC" ) || ( "$ext" == "doc" ) ) ]]; then
+ ~/Code/code/Scripts/convertToPDF.sh "$file" "$base.pdf"
+ fi
+ fi
+done
+
+
diff --git a/Scripts/Nautilus/Email File b/Scripts/Nautilus/Email File
new file mode 100755
index 0000000..1580de9
--- /dev/null
+++ b/Scripts/Nautilus/Email File
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+IFS='
+'
+MAIL=/usr/bin/mail
+SUBJECT="See attached file(s)"
+ATTACHMENT_FILES=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+MAIL_DOMAIN=`cat /etc/mailname`
+DEFAULT_EMAIL_ADDRESS=$USERNAME@$MAIL_DOMAIN
+FULL_NAME=`cat /etc/passwd | grep $USERNAME | cut -d ":" -f5 | cut -d "," -f1`
+EMAIL_MESSAGE="
+Please find the attached file(s).
+
+--
+Kind regards
+$FULL_NAME
+
+"
+DEST_MAIL_ADDR=`~/.gnome2/nautilus-scripts/.prompt-output.py "Email To:" "$DEFAULT_EMAIL_ADDRESS"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+USER_STR=`echo $DEFAULT_EMAIL_ADDRESS | base64`
+PASSWORD=`~/.gnome2/nautilus-scripts/.prompt-output.py "Enter password for $FULL_NAME <$DEFAULT_EMAIL_ADDRESS>:" "password"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+PASSWORD=`echo $PASSWORD | base64`
+
+cat > /tmp/tmp-message.bin << EOF
+EHLO $MAIL_DOMAIN
+AUTH LOGIN
+$USER_STR
+$PASSWORD
+MAIL FROM:$DEFAULT_EMAIL_ADDRESS
+RCPT TO:$DEST_MAIL_ADDR
+DATA
+From: "$FULL_NAME" <$DEFAULT_EMAIL_ADDRESS>
+To: <$DEST_MAIL_ADDR>
+Subject: $SUBJECT
+Content-Type: multipart/mixed; boundary="ARandomStringThatOnlyThisProgramWouldEverUse"
+MIME-Verion: 1.0
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Transfer-Encoding: quoted-printable
+Content-type: text/plain
+
+$EMAIL_MESSAGE
+
+EOF
+# echo -e $EMAIL_MESSAGE > /tmp/desc
+for FILE in ${ATTACHMENT_FILES}
+do
+ if [ -f "$FILE" ]; then
+ # mpack -a -s $SUBJECT -d /tmp/desc $FILE $DEST_MAIL_ADDR
+ BASE=`basename $FILE`
+ EXT=${FILE##*.}
+ MIME=`egrep "( | )$EXT( |$)" /etc/mime.types | cut -d ' ' -f 1`
+ [ "$MIME" == "" ] && MIME="application/octet-stream"
+ cat >> /tmp/tmp-message.bin << EOF
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Type: $MIME; name="$BASE"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="$BASE"
+
+EOF
+ base64 "$FILE" >> /tmp/tmp-message.bin
+ fi
+done
+echo "" >> /tmp/tmp-message.bin
+echo "--ARandomStringThatOnlyThisProgramWouldEverUse--" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "Some extra hidden text" >> /tmp/tmp-message.bin
+echo "Testing if this is seen or how it is handled" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "." >> /tmp/tmp-message.bin
+echo "QUIT" >> /tmp/tmp-message.bin
+
+
+#mime-construct --to ${DEST_MAIL_ADDR} --subject ${SUBJECT} --string ${EMAIL_MESSAGE} ${ARGS} --output --debug
+# $MAIL $DEST_MAIL_ADDR < /tmp/tmp-message.bin
+nc mail.$MAIL_DOMAIN 25 < /tmp/tmp-message.bin > /tmp/out
+rm -rf /tmp/tmp-message.bin
+
+OUTPUT=`cat /tmp/out | tail -n 2`
+
+~/.gnome2/nautilus-scripts/.done.py "Sent files to \"${DEST_MAIL_ADDR}\".
+
+Result:
+$OUTPUT
+"
+
+
diff --git a/Scripts/conversions.bas b/Scripts/conversions.bas
new file mode 100644
index 0000000..f54a51c
--- /dev/null
+++ b/Scripts/conversions.bas
@@ -0,0 +1,108 @@
+' Based on code from http://www.oooforum.org/forum/viewtopic.phtml?t=3772
+' 01-jun-06 jay Updated by to support "SaveAsOOOFlat" (Save as Flat XML)
+
+' Save document as an Acrobat PDF file.
+Sub SaveAsPDF( cFile, oFile )
+ cURL = ConvertToURL( cFile )
+ ' Open the document. Just blindly assume that the document
+ ' is of a type that OOo will correctly recognize and open
+ ' without specifying an import filter.
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+ ' cFile = Left( cFile, Len( cFile ) - 4 ) + ".pdf"
+ cURL = ConvertToURL( oFile )
+
+ ' Save the document using a filter.
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "writer_pdf_Export" ))
+
+ oDoc.close( True )
+End Sub
+
+' Save document as a Microsoft Word file.
+Sub SaveAsDoc( cFile )
+ ' mostly a copy of SaveAsPDF
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+
+ cFile = Left( cFile, Len( cFile ) - 4 ) + ".doc"
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "MS WinWord 6.0" ),)
+ oDoc.close( True )
+
+End Sub
+
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOO( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "ppt" ' PowerPoint file.
+ cFileExt = "odp"
+ Case "doc" ' Word file.
+ cFileExt = "odt"
+ Case "xls" ' Excel file.
+ cFileExt = "ods"
+ Case Else
+ cFileExt = "xxx"
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array() )
+ oDoc.close( True )
+
+End Sub
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOOFlat( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "doc", "odt" ' Word file.
+ cFileExt = "oft"
+ cFilterName = "OpenDocument Text Flat"
+ Case "ppt", "odp" ' PowerPoint file.
+ cFileExt = "ofp"
+ cFilterName = "OpenDocument Presentation Flat"
+ Case "xls", "ods" ' Excel file.
+ cFileExt = "ofs"
+ cFilterName = "OpenDocument Spreadsheet Flat"
+
+ Case Else
+ ' Default to unknown filter
+ cFileExt = "xxx"
+ cFilterName = ""
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array(MakePropertyValue( "FilterName", cFilterName ),) )
+ oDoc.close( True )
+
+End Sub
+
+Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
+ Dim oPropertyValue As New com.sun.star.beans.PropertyValue
+ If Not IsMissing( cName ) Then
+ oPropertyValue.Name = cName
+ EndIf
+ If Not IsMissing( uValue ) Then
+ oPropertyValue.Value = uValue
+ EndIf
+ MakePropertyValue() = oPropertyValue
+End Function
diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/Convert DOC to PDF b/Scripts/Nautilus/Convert DOC to PDF
new file mode 100755
index 0000000..641caf3
--- /dev/null
+++ b/Scripts/Nautilus/Convert DOC to PDF
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo Installing document conversions macro
+~/Code/code/Scripts/installOpenOfficeMacro.sh ~/Code/code/Scripts/conversions.bas
+echo Installed document conversions macro
+
+IFS='
+'
+fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+for file in $fpaths
+do
+ if [ -f "$file" ]; then
+ base=${file%.*}
+ ext=${file##*.}
+ if [[ ( ( "$ext" == "ODT" ) || ( "$ext" == "odt" ) ) || ( ( "$ext" == "DOC" ) || ( "$ext" == "doc" ) ) ]]; then
+ ~/Code/code/Scripts/convertToPDF.sh "$file" "$base.pdf"
+ fi
+ fi
+done
+
+
diff --git a/Scripts/Nautilus/Email File b/Scripts/Nautilus/Email File
new file mode 100755
index 0000000..1580de9
--- /dev/null
+++ b/Scripts/Nautilus/Email File
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+IFS='
+'
+MAIL=/usr/bin/mail
+SUBJECT="See attached file(s)"
+ATTACHMENT_FILES=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+MAIL_DOMAIN=`cat /etc/mailname`
+DEFAULT_EMAIL_ADDRESS=$USERNAME@$MAIL_DOMAIN
+FULL_NAME=`cat /etc/passwd | grep $USERNAME | cut -d ":" -f5 | cut -d "," -f1`
+EMAIL_MESSAGE="
+Please find the attached file(s).
+
+--
+Kind regards
+$FULL_NAME
+
+"
+DEST_MAIL_ADDR=`~/.gnome2/nautilus-scripts/.prompt-output.py "Email To:" "$DEFAULT_EMAIL_ADDRESS"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+USER_STR=`echo $DEFAULT_EMAIL_ADDRESS | base64`
+PASSWORD=`~/.gnome2/nautilus-scripts/.prompt-output.py "Enter password for $FULL_NAME <$DEFAULT_EMAIL_ADDRESS>:" "password"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+PASSWORD=`echo $PASSWORD | base64`
+
+cat > /tmp/tmp-message.bin << EOF
+EHLO $MAIL_DOMAIN
+AUTH LOGIN
+$USER_STR
+$PASSWORD
+MAIL FROM:$DEFAULT_EMAIL_ADDRESS
+RCPT TO:$DEST_MAIL_ADDR
+DATA
+From: "$FULL_NAME" <$DEFAULT_EMAIL_ADDRESS>
+To: <$DEST_MAIL_ADDR>
+Subject: $SUBJECT
+Content-Type: multipart/mixed; boundary="ARandomStringThatOnlyThisProgramWouldEverUse"
+MIME-Verion: 1.0
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Transfer-Encoding: quoted-printable
+Content-type: text/plain
+
+$EMAIL_MESSAGE
+
+EOF
+# echo -e $EMAIL_MESSAGE > /tmp/desc
+for FILE in ${ATTACHMENT_FILES}
+do
+ if [ -f "$FILE" ]; then
+ # mpack -a -s $SUBJECT -d /tmp/desc $FILE $DEST_MAIL_ADDR
+ BASE=`basename $FILE`
+ EXT=${FILE##*.}
+ MIME=`egrep "( | )$EXT( |$)" /etc/mime.types | cut -d ' ' -f 1`
+ [ "$MIME" == "" ] && MIME="application/octet-stream"
+ cat >> /tmp/tmp-message.bin << EOF
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Type: $MIME; name="$BASE"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="$BASE"
+
+EOF
+ base64 "$FILE" >> /tmp/tmp-message.bin
+ fi
+done
+echo "" >> /tmp/tmp-message.bin
+echo "--ARandomStringThatOnlyThisProgramWouldEverUse--" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "Some extra hidden text" >> /tmp/tmp-message.bin
+echo "Testing if this is seen or how it is handled" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "." >> /tmp/tmp-message.bin
+echo "QUIT" >> /tmp/tmp-message.bin
+
+
+#mime-construct --to ${DEST_MAIL_ADDR} --subject ${SUBJECT} --string ${EMAIL_MESSAGE} ${ARGS} --output --debug
+# $MAIL $DEST_MAIL_ADDR < /tmp/tmp-message.bin
+nc mail.$MAIL_DOMAIN 25 < /tmp/tmp-message.bin > /tmp/out
+rm -rf /tmp/tmp-message.bin
+
+OUTPUT=`cat /tmp/out | tail -n 2`
+
+~/.gnome2/nautilus-scripts/.done.py "Sent files to \"${DEST_MAIL_ADDR}\".
+
+Result:
+$OUTPUT
+"
+
+
diff --git a/Scripts/conversions.bas b/Scripts/conversions.bas
new file mode 100644
index 0000000..f54a51c
--- /dev/null
+++ b/Scripts/conversions.bas
@@ -0,0 +1,108 @@
+' Based on code from http://www.oooforum.org/forum/viewtopic.phtml?t=3772
+' 01-jun-06 jay Updated by to support "SaveAsOOOFlat" (Save as Flat XML)
+
+' Save document as an Acrobat PDF file.
+Sub SaveAsPDF( cFile, oFile )
+ cURL = ConvertToURL( cFile )
+ ' Open the document. Just blindly assume that the document
+ ' is of a type that OOo will correctly recognize and open
+ ' without specifying an import filter.
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+ ' cFile = Left( cFile, Len( cFile ) - 4 ) + ".pdf"
+ cURL = ConvertToURL( oFile )
+
+ ' Save the document using a filter.
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "writer_pdf_Export" ))
+
+ oDoc.close( True )
+End Sub
+
+' Save document as a Microsoft Word file.
+Sub SaveAsDoc( cFile )
+ ' mostly a copy of SaveAsPDF
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+
+ cFile = Left( cFile, Len( cFile ) - 4 ) + ".doc"
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "MS WinWord 6.0" ),)
+ oDoc.close( True )
+
+End Sub
+
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOO( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "ppt" ' PowerPoint file.
+ cFileExt = "odp"
+ Case "doc" ' Word file.
+ cFileExt = "odt"
+ Case "xls" ' Excel file.
+ cFileExt = "ods"
+ Case Else
+ cFileExt = "xxx"
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array() )
+ oDoc.close( True )
+
+End Sub
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOOFlat( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "doc", "odt" ' Word file.
+ cFileExt = "oft"
+ cFilterName = "OpenDocument Text Flat"
+ Case "ppt", "odp" ' PowerPoint file.
+ cFileExt = "ofp"
+ cFilterName = "OpenDocument Presentation Flat"
+ Case "xls", "ods" ' Excel file.
+ cFileExt = "ofs"
+ cFilterName = "OpenDocument Spreadsheet Flat"
+
+ Case Else
+ ' Default to unknown filter
+ cFileExt = "xxx"
+ cFilterName = ""
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array(MakePropertyValue( "FilterName", cFilterName ),) )
+ oDoc.close( True )
+
+End Sub
+
+Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
+ Dim oPropertyValue As New com.sun.star.beans.PropertyValue
+ If Not IsMissing( cName ) Then
+ oPropertyValue.Name = cName
+ EndIf
+ If Not IsMissing( uValue ) Then
+ oPropertyValue.Value = uValue
+ EndIf
+ MakePropertyValue() = oPropertyValue
+End Function
diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh
index e8ac44a..056755f 100755
--- a/Scripts/convertToPDF.sh
+++ b/Scripts/convertToPDF.sh
@@ -17,11 +17,38 @@
# CREATED: 06/25/08 17:26:25 CST
# REVISION: ---
#===============================================================================
-if [ -f "$1" ]
+
+OO_BIN=
+
+if [ "`uname`" == "Linux" ]
then
- echo "Converting \"$1\" to PDF"
- /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\)
+ OO_BIN=/usr/lib/openoffice/program/soffice
else
- echo "Usage: $0 filename"
+ OO_BIN=/Applications/NeoOffice.app/Contents/MacOS/soffice
+fi
+
+IN="$1"
+OUT="$2"
+
+[ ! -f "$IN" ] && IN="$PWD/$1"
+#[ ! -f "$OUT" ] && OUT="$PWD/$2"
+
+if [ -f "$IN" ]
+then
+ if [ "$2" == "" ]
+ then
+ echo "Usage: $0 inputfile outputfile"
+ exit -1
+ fi
+ if [ -f "$OUT" ]
+ then
+ echo "convertToPDF.sh aborting, destination file aready exists, delete first"
+ exit -1
+ fi
+ echo "Converting \"$1\" to PDF"
+ $OO_BIN -invisible macro:///Standard.conversions.SaveAsPDF\("$IN","$OUT"\)
+else
+ echo "Usage: $0 inputfile outputfile"
+ exit -1
fi
diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/Convert DOC to PDF b/Scripts/Nautilus/Convert DOC to PDF
new file mode 100755
index 0000000..641caf3
--- /dev/null
+++ b/Scripts/Nautilus/Convert DOC to PDF
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo Installing document conversions macro
+~/Code/code/Scripts/installOpenOfficeMacro.sh ~/Code/code/Scripts/conversions.bas
+echo Installed document conversions macro
+
+IFS='
+'
+fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+for file in $fpaths
+do
+ if [ -f "$file" ]; then
+ base=${file%.*}
+ ext=${file##*.}
+ if [[ ( ( "$ext" == "ODT" ) || ( "$ext" == "odt" ) ) || ( ( "$ext" == "DOC" ) || ( "$ext" == "doc" ) ) ]]; then
+ ~/Code/code/Scripts/convertToPDF.sh "$file" "$base.pdf"
+ fi
+ fi
+done
+
+
diff --git a/Scripts/Nautilus/Email File b/Scripts/Nautilus/Email File
new file mode 100755
index 0000000..1580de9
--- /dev/null
+++ b/Scripts/Nautilus/Email File
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+IFS='
+'
+MAIL=/usr/bin/mail
+SUBJECT="See attached file(s)"
+ATTACHMENT_FILES=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+MAIL_DOMAIN=`cat /etc/mailname`
+DEFAULT_EMAIL_ADDRESS=$USERNAME@$MAIL_DOMAIN
+FULL_NAME=`cat /etc/passwd | grep $USERNAME | cut -d ":" -f5 | cut -d "," -f1`
+EMAIL_MESSAGE="
+Please find the attached file(s).
+
+--
+Kind regards
+$FULL_NAME
+
+"
+DEST_MAIL_ADDR=`~/.gnome2/nautilus-scripts/.prompt-output.py "Email To:" "$DEFAULT_EMAIL_ADDRESS"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+USER_STR=`echo $DEFAULT_EMAIL_ADDRESS | base64`
+PASSWORD=`~/.gnome2/nautilus-scripts/.prompt-output.py "Enter password for $FULL_NAME <$DEFAULT_EMAIL_ADDRESS>:" "password"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+PASSWORD=`echo $PASSWORD | base64`
+
+cat > /tmp/tmp-message.bin << EOF
+EHLO $MAIL_DOMAIN
+AUTH LOGIN
+$USER_STR
+$PASSWORD
+MAIL FROM:$DEFAULT_EMAIL_ADDRESS
+RCPT TO:$DEST_MAIL_ADDR
+DATA
+From: "$FULL_NAME" <$DEFAULT_EMAIL_ADDRESS>
+To: <$DEST_MAIL_ADDR>
+Subject: $SUBJECT
+Content-Type: multipart/mixed; boundary="ARandomStringThatOnlyThisProgramWouldEverUse"
+MIME-Verion: 1.0
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Transfer-Encoding: quoted-printable
+Content-type: text/plain
+
+$EMAIL_MESSAGE
+
+EOF
+# echo -e $EMAIL_MESSAGE > /tmp/desc
+for FILE in ${ATTACHMENT_FILES}
+do
+ if [ -f "$FILE" ]; then
+ # mpack -a -s $SUBJECT -d /tmp/desc $FILE $DEST_MAIL_ADDR
+ BASE=`basename $FILE`
+ EXT=${FILE##*.}
+ MIME=`egrep "( | )$EXT( |$)" /etc/mime.types | cut -d ' ' -f 1`
+ [ "$MIME" == "" ] && MIME="application/octet-stream"
+ cat >> /tmp/tmp-message.bin << EOF
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Type: $MIME; name="$BASE"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="$BASE"
+
+EOF
+ base64 "$FILE" >> /tmp/tmp-message.bin
+ fi
+done
+echo "" >> /tmp/tmp-message.bin
+echo "--ARandomStringThatOnlyThisProgramWouldEverUse--" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "Some extra hidden text" >> /tmp/tmp-message.bin
+echo "Testing if this is seen or how it is handled" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "." >> /tmp/tmp-message.bin
+echo "QUIT" >> /tmp/tmp-message.bin
+
+
+#mime-construct --to ${DEST_MAIL_ADDR} --subject ${SUBJECT} --string ${EMAIL_MESSAGE} ${ARGS} --output --debug
+# $MAIL $DEST_MAIL_ADDR < /tmp/tmp-message.bin
+nc mail.$MAIL_DOMAIN 25 < /tmp/tmp-message.bin > /tmp/out
+rm -rf /tmp/tmp-message.bin
+
+OUTPUT=`cat /tmp/out | tail -n 2`
+
+~/.gnome2/nautilus-scripts/.done.py "Sent files to \"${DEST_MAIL_ADDR}\".
+
+Result:
+$OUTPUT
+"
+
+
diff --git a/Scripts/conversions.bas b/Scripts/conversions.bas
new file mode 100644
index 0000000..f54a51c
--- /dev/null
+++ b/Scripts/conversions.bas
@@ -0,0 +1,108 @@
+' Based on code from http://www.oooforum.org/forum/viewtopic.phtml?t=3772
+' 01-jun-06 jay Updated by to support "SaveAsOOOFlat" (Save as Flat XML)
+
+' Save document as an Acrobat PDF file.
+Sub SaveAsPDF( cFile, oFile )
+ cURL = ConvertToURL( cFile )
+ ' Open the document. Just blindly assume that the document
+ ' is of a type that OOo will correctly recognize and open
+ ' without specifying an import filter.
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+ ' cFile = Left( cFile, Len( cFile ) - 4 ) + ".pdf"
+ cURL = ConvertToURL( oFile )
+
+ ' Save the document using a filter.
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "writer_pdf_Export" ))
+
+ oDoc.close( True )
+End Sub
+
+' Save document as a Microsoft Word file.
+Sub SaveAsDoc( cFile )
+ ' mostly a copy of SaveAsPDF
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+
+ cFile = Left( cFile, Len( cFile ) - 4 ) + ".doc"
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "MS WinWord 6.0" ),)
+ oDoc.close( True )
+
+End Sub
+
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOO( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "ppt" ' PowerPoint file.
+ cFileExt = "odp"
+ Case "doc" ' Word file.
+ cFileExt = "odt"
+ Case "xls" ' Excel file.
+ cFileExt = "ods"
+ Case Else
+ cFileExt = "xxx"
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array() )
+ oDoc.close( True )
+
+End Sub
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOOFlat( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "doc", "odt" ' Word file.
+ cFileExt = "oft"
+ cFilterName = "OpenDocument Text Flat"
+ Case "ppt", "odp" ' PowerPoint file.
+ cFileExt = "ofp"
+ cFilterName = "OpenDocument Presentation Flat"
+ Case "xls", "ods" ' Excel file.
+ cFileExt = "ofs"
+ cFilterName = "OpenDocument Spreadsheet Flat"
+
+ Case Else
+ ' Default to unknown filter
+ cFileExt = "xxx"
+ cFilterName = ""
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array(MakePropertyValue( "FilterName", cFilterName ),) )
+ oDoc.close( True )
+
+End Sub
+
+Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
+ Dim oPropertyValue As New com.sun.star.beans.PropertyValue
+ If Not IsMissing( cName ) Then
+ oPropertyValue.Name = cName
+ EndIf
+ If Not IsMissing( uValue ) Then
+ oPropertyValue.Value = uValue
+ EndIf
+ MakePropertyValue() = oPropertyValue
+End Function
diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh
index e8ac44a..056755f 100755
--- a/Scripts/convertToPDF.sh
+++ b/Scripts/convertToPDF.sh
@@ -17,11 +17,38 @@
# CREATED: 06/25/08 17:26:25 CST
# REVISION: ---
#===============================================================================
-if [ -f "$1" ]
+
+OO_BIN=
+
+if [ "`uname`" == "Linux" ]
then
- echo "Converting \"$1\" to PDF"
- /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\)
+ OO_BIN=/usr/lib/openoffice/program/soffice
else
- echo "Usage: $0 filename"
+ OO_BIN=/Applications/NeoOffice.app/Contents/MacOS/soffice
+fi
+
+IN="$1"
+OUT="$2"
+
+[ ! -f "$IN" ] && IN="$PWD/$1"
+#[ ! -f "$OUT" ] && OUT="$PWD/$2"
+
+if [ -f "$IN" ]
+then
+ if [ "$2" == "" ]
+ then
+ echo "Usage: $0 inputfile outputfile"
+ exit -1
+ fi
+ if [ -f "$OUT" ]
+ then
+ echo "convertToPDF.sh aborting, destination file aready exists, delete first"
+ exit -1
+ fi
+ echo "Converting \"$1\" to PDF"
+ $OO_BIN -invisible macro:///Standard.conversions.SaveAsPDF\("$IN","$OUT"\)
+else
+ echo "Usage: $0 inputfile outputfile"
+ exit -1
fi
diff --git a/Scripts/installOpenOfficeMacro.sh b/Scripts/installOpenOfficeMacro.sh
new file mode 100755
index 0000000..edc9f78
--- /dev/null
+++ b/Scripts/installOpenOfficeMacro.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+#===============================================================================
+#
+# FILE: installOpenOfficeMacro.sh
+#
+# USAGE: ./installOpenOfficeMacro.sh
+#
+# DESCRIPTION: Installs this given OpenOffice macro in to the users OpenOffice install
+# so that the macro can be used from a script
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: John Ryland (jryland@xiaofrog.com)
+# COMPANY: InvertedLogic
+# VERSION: 1.0
+# CREATED: 06/29/08 17:15:25 CST
+# REVISION: ---
+#===============================================================================
+if [ "$1" == "" ]
+then
+ echo "Usage: $0 file.bas"
+ echo "(file should be in the current directory and no ./ prepended to it)"
+ exit -1
+fi
+
+if ! [ -f "$1" ]
+then
+ echo "$0 error: File not found or not regular file"
+ exit -1
+fi
+
+BASE=${1%.*}
+
+#
+# Some of this script comes from script found from here:
+# http://kambing.ui.edu/gentoo-portage/app-office/indeview/indeview-0.6.6.ebuild
+#
+# Converts the plain text .bas file to an OpenOffice xml script file
+cp "$1" "$1.tmp"
+# Convert special characters to XML's &XXX; style
+
+if [ "`uname`" == "Linux" ]
+then
+sed -i -e 's/&/\&/g' "$1.tmp"
+sed -i -e 's/"/\"/g' "$1.tmp"
+sed -i -e 's/\</g' "$1.tmp"
+sed -i -e 's/>/\>/g' "$1.tmp"
+sed -i -e "s/'/\'/g" "$1.tmp"
+sed -i -e "s/
//g" "$1.tmp"
+else
+sed -i "" -e 's/&/\&/g' "$1.tmp"
+sed -i "" -e 's/"/\"/g' "$1.tmp"
+sed -i "" -e 's/\</g' "$1.tmp"
+sed -i "" -e 's/>/\>/g' "$1.tmp"
+sed -i "" -e "s/'/\'/g" "$1.tmp"
+sed -i "" -e "s/
//g" "$1.tmp"
+fi
+
+cat >> "$BASE.xba" << _EOF_
+
+
+
+_EOF_
+cat "$1.tmp" >> "$BASE.xba"
+cat >> "$BASE.xba" << _EOF_
+
+_EOF_
+rm "$1.tmp"
+
+#
+# Find the directory we should install the macro to
+#
+if [ -e ~/.openoffice.org/3/user/basic/Standard/ ] # On Linux it should be somewhere like this
+then
+ BASIC_DIR=~/.openoffice.org/3/user/basic/Standard/
+elif [ -e ~/.openoffice.org2.0/user/basic/Standard/ ] # Or here
+then
+ BASIC_DIR=~/.openoffice.org2.0/user/basic/Standard/
+elif [ -e ~/.openoffice.org2/user/basic/Standard/ ] # Or here
+then
+ BASIC_DIR=~/.openoffice.org2/user/basic/Standard/
+elif [ -e ~/Library/Preferences/NeoOffice-2.2/user/basic/Standard/ ] # On Mac it is here if using NeoOffice
+then
+ BASIC_DIR=~/Library/Preferences/NeoOffice-2.2/user/basic/Standard/
+elif [ -e %APPDATA%/OpenOffice.org2/user/basic/Standard/ ] # On Windows
+then
+ BASIC_DIR=%APPDATA%/OpenOffice.org2/user/basic/Standard/
+else
+ echo "$0 error: Sorry don't know where to install the macro to"
+ echo " - Requires OpenOffice or NeoOffice to be installed to batch convert docs to PDF"
+ echo " - This error is from installMacro.sh, fix errors or add platforms here"
+ exit -1
+fi
+
+#
+# now actually install the converted file
+#
+mv "$BASE.xba" "$BASIC_DIR"
+#
+# Append the macro file to the library of macros
+#
+grep "$BASE" "$BASIC_DIR/script.xlb" > /dev/null 2>&1 || sed -i "" -e 's;; \
+;' "$BASIC_DIR/script.xlb"
+
+
diff --git a/Scripts/Nautilus/.prompt-output.py b/Scripts/Nautilus/.prompt-output.py
index ce94e38..2afb22b 100755
--- a/Scripts/Nautilus/.prompt-output.py
+++ b/Scripts/Nautilus/.prompt-output.py
@@ -6,22 +6,50 @@
import pygtk
pygtk.require('2.0')
import gtk
+import sys
# Run the class if this file is run directly
if __name__ == "__main__":
dialog = gtk.Dialog("Output", None, gtk.DIALOG_MODAL,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ argc = len(sys.argv)
+
label = gtk.Label()
- label.set_text("\n Please Enter Output Filename: \n")
+ if ( argc > 1 ):
+ label.set_text("\n " + sys.argv[1] + " \n" )
+ else:
+ label.set_text("\n Please Enter Output Filename: \n")
dialog.vbox.add(label)
label.show()
lineedit = gtk.Entry()
- lineedit.set_text("output")
+ if ( argc > 2 ):
+ if (sys.argv[2] == "password"):
+ lineedit.set_visibility(False)
+ else:
+ lineedit.set_text(sys.argv[2])
+ else:
+ lineedit.set_text("output")
lineedit.show()
dialog.vbox.add(lineedit)
+
+ if ( argc > 4 ):
+ label2 = gtk.Label()
+ label2.set_text("\n " + sys.argv[3] + " \n" )
+ dialog.vbox.add(label2)
+ label2.show()
+ lineedit2 = gtk.Entry()
+ if (sys.argv[4] == "password"):
+ lineedit2.set_visibility(False)
+ else:
+ lineedit2.set_text(sys.argv[4])
+ lineedit2.show()
+ dialog.vbox.add(lineedit2)
+
dialog.show()
if ( dialog.run() == gtk.RESPONSE_ACCEPT ):
print lineedit.get_text()
+ if ( argc > 4 ):
+ print lineedit2.get_text()
exit(-1)
else:
print "err"
diff --git a/Scripts/Nautilus/Convert DOC to PDF b/Scripts/Nautilus/Convert DOC to PDF
new file mode 100755
index 0000000..641caf3
--- /dev/null
+++ b/Scripts/Nautilus/Convert DOC to PDF
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo Installing document conversions macro
+~/Code/code/Scripts/installOpenOfficeMacro.sh ~/Code/code/Scripts/conversions.bas
+echo Installed document conversions macro
+
+IFS='
+'
+fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+for file in $fpaths
+do
+ if [ -f "$file" ]; then
+ base=${file%.*}
+ ext=${file##*.}
+ if [[ ( ( "$ext" == "ODT" ) || ( "$ext" == "odt" ) ) || ( ( "$ext" == "DOC" ) || ( "$ext" == "doc" ) ) ]]; then
+ ~/Code/code/Scripts/convertToPDF.sh "$file" "$base.pdf"
+ fi
+ fi
+done
+
+
diff --git a/Scripts/Nautilus/Email File b/Scripts/Nautilus/Email File
new file mode 100755
index 0000000..1580de9
--- /dev/null
+++ b/Scripts/Nautilus/Email File
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+IFS='
+'
+MAIL=/usr/bin/mail
+SUBJECT="See attached file(s)"
+ATTACHMENT_FILES=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
+MAIL_DOMAIN=`cat /etc/mailname`
+DEFAULT_EMAIL_ADDRESS=$USERNAME@$MAIL_DOMAIN
+FULL_NAME=`cat /etc/passwd | grep $USERNAME | cut -d ":" -f5 | cut -d "," -f1`
+EMAIL_MESSAGE="
+Please find the attached file(s).
+
+--
+Kind regards
+$FULL_NAME
+
+"
+DEST_MAIL_ADDR=`~/.gnome2/nautilus-scripts/.prompt-output.py "Email To:" "$DEFAULT_EMAIL_ADDRESS"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+USER_STR=`echo $DEFAULT_EMAIL_ADDRESS | base64`
+PASSWORD=`~/.gnome2/nautilus-scripts/.prompt-output.py "Enter password for $FULL_NAME <$DEFAULT_EMAIL_ADDRESS>:" "password"`
+if [ "$?" == "0" ]
+then
+ exit
+fi
+PASSWORD=`echo $PASSWORD | base64`
+
+cat > /tmp/tmp-message.bin << EOF
+EHLO $MAIL_DOMAIN
+AUTH LOGIN
+$USER_STR
+$PASSWORD
+MAIL FROM:$DEFAULT_EMAIL_ADDRESS
+RCPT TO:$DEST_MAIL_ADDR
+DATA
+From: "$FULL_NAME" <$DEFAULT_EMAIL_ADDRESS>
+To: <$DEST_MAIL_ADDR>
+Subject: $SUBJECT
+Content-Type: multipart/mixed; boundary="ARandomStringThatOnlyThisProgramWouldEverUse"
+MIME-Verion: 1.0
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Transfer-Encoding: quoted-printable
+Content-type: text/plain
+
+$EMAIL_MESSAGE
+
+EOF
+# echo -e $EMAIL_MESSAGE > /tmp/desc
+for FILE in ${ATTACHMENT_FILES}
+do
+ if [ -f "$FILE" ]; then
+ # mpack -a -s $SUBJECT -d /tmp/desc $FILE $DEST_MAIL_ADDR
+ BASE=`basename $FILE`
+ EXT=${FILE##*.}
+ MIME=`egrep "( | )$EXT( |$)" /etc/mime.types | cut -d ' ' -f 1`
+ [ "$MIME" == "" ] && MIME="application/octet-stream"
+ cat >> /tmp/tmp-message.bin << EOF
+
+--ARandomStringThatOnlyThisProgramWouldEverUse
+Content-Type: $MIME; name="$BASE"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="$BASE"
+
+EOF
+ base64 "$FILE" >> /tmp/tmp-message.bin
+ fi
+done
+echo "" >> /tmp/tmp-message.bin
+echo "--ARandomStringThatOnlyThisProgramWouldEverUse--" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "Some extra hidden text" >> /tmp/tmp-message.bin
+echo "Testing if this is seen or how it is handled" >> /tmp/tmp-message.bin
+echo "" >> /tmp/tmp-message.bin
+echo "." >> /tmp/tmp-message.bin
+echo "QUIT" >> /tmp/tmp-message.bin
+
+
+#mime-construct --to ${DEST_MAIL_ADDR} --subject ${SUBJECT} --string ${EMAIL_MESSAGE} ${ARGS} --output --debug
+# $MAIL $DEST_MAIL_ADDR < /tmp/tmp-message.bin
+nc mail.$MAIL_DOMAIN 25 < /tmp/tmp-message.bin > /tmp/out
+rm -rf /tmp/tmp-message.bin
+
+OUTPUT=`cat /tmp/out | tail -n 2`
+
+~/.gnome2/nautilus-scripts/.done.py "Sent files to \"${DEST_MAIL_ADDR}\".
+
+Result:
+$OUTPUT
+"
+
+
diff --git a/Scripts/conversions.bas b/Scripts/conversions.bas
new file mode 100644
index 0000000..f54a51c
--- /dev/null
+++ b/Scripts/conversions.bas
@@ -0,0 +1,108 @@
+' Based on code from http://www.oooforum.org/forum/viewtopic.phtml?t=3772
+' 01-jun-06 jay Updated by to support "SaveAsOOOFlat" (Save as Flat XML)
+
+' Save document as an Acrobat PDF file.
+Sub SaveAsPDF( cFile, oFile )
+ cURL = ConvertToURL( cFile )
+ ' Open the document. Just blindly assume that the document
+ ' is of a type that OOo will correctly recognize and open
+ ' without specifying an import filter.
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+ ' cFile = Left( cFile, Len( cFile ) - 4 ) + ".pdf"
+ cURL = ConvertToURL( oFile )
+
+ ' Save the document using a filter.
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "writer_pdf_Export" ))
+
+ oDoc.close( True )
+End Sub
+
+' Save document as a Microsoft Word file.
+Sub SaveAsDoc( cFile )
+ ' mostly a copy of SaveAsPDF
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))
+
+
+ cFile = Left( cFile, Len( cFile ) - 4 ) + ".doc"
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeToURL( cURL, Array(MakePropertyValue( "FilterName", "MS WinWord 6.0" ),)
+ oDoc.close( True )
+
+End Sub
+
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOO( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "ppt" ' PowerPoint file.
+ cFileExt = "odp"
+ Case "doc" ' Word file.
+ cFileExt = "odt"
+ Case "xls" ' Excel file.
+ cFileExt = "ods"
+ Case Else
+ cFileExt = "xxx"
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array() )
+ oDoc.close( True )
+
+End Sub
+
+' Save document as an OpenOffice 2 file.
+Sub SaveAsOOOFlat( cFile )
+ ' mostly a copy of SaveAsPDF. Save as an OpenOffice file.
+ cURL = ConvertToURL( cFile )
+ oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True ),))
+
+ ' Set output file extension based on lower-case
+ ' version of input extension.
+ Select Case LCase(Right(cFile,3))
+ ' Microsoft Office Files
+ Case "doc", "odt" ' Word file.
+ cFileExt = "oft"
+ cFilterName = "OpenDocument Text Flat"
+ Case "ppt", "odp" ' PowerPoint file.
+ cFileExt = "ofp"
+ cFilterName = "OpenDocument Presentation Flat"
+ Case "xls", "ods" ' Excel file.
+ cFileExt = "ofs"
+ cFilterName = "OpenDocument Spreadsheet Flat"
+
+ Case Else
+ ' Default to unknown filter
+ cFileExt = "xxx"
+ cFilterName = ""
+ End Select
+
+ cFile = Left( cFile, Len( cFile ) - 3 ) + cFileExt
+ cURL = ConvertToURL( cFile )
+
+ oDoc.storeAsURL( cURL, Array(MakePropertyValue( "FilterName", cFilterName ),) )
+ oDoc.close( True )
+
+End Sub
+
+Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
+ Dim oPropertyValue As New com.sun.star.beans.PropertyValue
+ If Not IsMissing( cName ) Then
+ oPropertyValue.Name = cName
+ EndIf
+ If Not IsMissing( uValue ) Then
+ oPropertyValue.Value = uValue
+ EndIf
+ MakePropertyValue() = oPropertyValue
+End Function
diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh
index e8ac44a..056755f 100755
--- a/Scripts/convertToPDF.sh
+++ b/Scripts/convertToPDF.sh
@@ -17,11 +17,38 @@
# CREATED: 06/25/08 17:26:25 CST
# REVISION: ---
#===============================================================================
-if [ -f "$1" ]
+
+OO_BIN=
+
+if [ "`uname`" == "Linux" ]
then
- echo "Converting \"$1\" to PDF"
- /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\)
+ OO_BIN=/usr/lib/openoffice/program/soffice
else
- echo "Usage: $0 filename"
+ OO_BIN=/Applications/NeoOffice.app/Contents/MacOS/soffice
+fi
+
+IN="$1"
+OUT="$2"
+
+[ ! -f "$IN" ] && IN="$PWD/$1"
+#[ ! -f "$OUT" ] && OUT="$PWD/$2"
+
+if [ -f "$IN" ]
+then
+ if [ "$2" == "" ]
+ then
+ echo "Usage: $0 inputfile outputfile"
+ exit -1
+ fi
+ if [ -f "$OUT" ]
+ then
+ echo "convertToPDF.sh aborting, destination file aready exists, delete first"
+ exit -1
+ fi
+ echo "Converting \"$1\" to PDF"
+ $OO_BIN -invisible macro:///Standard.conversions.SaveAsPDF\("$IN","$OUT"\)
+else
+ echo "Usage: $0 inputfile outputfile"
+ exit -1
fi
diff --git a/Scripts/installOpenOfficeMacro.sh b/Scripts/installOpenOfficeMacro.sh
new file mode 100755
index 0000000..edc9f78
--- /dev/null
+++ b/Scripts/installOpenOfficeMacro.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+#===============================================================================
+#
+# FILE: installOpenOfficeMacro.sh
+#
+# USAGE: ./installOpenOfficeMacro.sh
+#
+# DESCRIPTION: Installs this given OpenOffice macro in to the users OpenOffice install
+# so that the macro can be used from a script
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: John Ryland (jryland@xiaofrog.com)
+# COMPANY: InvertedLogic
+# VERSION: 1.0
+# CREATED: 06/29/08 17:15:25 CST
+# REVISION: ---
+#===============================================================================
+if [ "$1" == "" ]
+then
+ echo "Usage: $0 file.bas"
+ echo "(file should be in the current directory and no ./ prepended to it)"
+ exit -1
+fi
+
+if ! [ -f "$1" ]
+then
+ echo "$0 error: File not found or not regular file"
+ exit -1
+fi
+
+BASE=${1%.*}
+
+#
+# Some of this script comes from script found from here:
+# http://kambing.ui.edu/gentoo-portage/app-office/indeview/indeview-0.6.6.ebuild
+#
+# Converts the plain text .bas file to an OpenOffice xml script file
+cp "$1" "$1.tmp"
+# Convert special characters to XML's &XXX; style
+
+if [ "`uname`" == "Linux" ]
+then
+sed -i -e 's/&/\&/g' "$1.tmp"
+sed -i -e 's/"/\"/g' "$1.tmp"
+sed -i -e 's/\</g' "$1.tmp"
+sed -i -e 's/>/\>/g' "$1.tmp"
+sed -i -e "s/'/\'/g" "$1.tmp"
+sed -i -e "s/
//g" "$1.tmp"
+else
+sed -i "" -e 's/&/\&/g' "$1.tmp"
+sed -i "" -e 's/"/\"/g' "$1.tmp"
+sed -i "" -e 's/\</g' "$1.tmp"
+sed -i "" -e 's/>/\>/g' "$1.tmp"
+sed -i "" -e "s/'/\'/g" "$1.tmp"
+sed -i "" -e "s/
//g" "$1.tmp"
+fi
+
+cat >> "$BASE.xba" << _EOF_
+
+
+
+_EOF_
+cat "$1.tmp" >> "$BASE.xba"
+cat >> "$BASE.xba" << _EOF_
+
+_EOF_
+rm "$1.tmp"
+
+#
+# Find the directory we should install the macro to
+#
+if [ -e ~/.openoffice.org/3/user/basic/Standard/ ] # On Linux it should be somewhere like this
+then
+ BASIC_DIR=~/.openoffice.org/3/user/basic/Standard/
+elif [ -e ~/.openoffice.org2.0/user/basic/Standard/ ] # Or here
+then
+ BASIC_DIR=~/.openoffice.org2.0/user/basic/Standard/
+elif [ -e ~/.openoffice.org2/user/basic/Standard/ ] # Or here
+then
+ BASIC_DIR=~/.openoffice.org2/user/basic/Standard/
+elif [ -e ~/Library/Preferences/NeoOffice-2.2/user/basic/Standard/ ] # On Mac it is here if using NeoOffice
+then
+ BASIC_DIR=~/Library/Preferences/NeoOffice-2.2/user/basic/Standard/
+elif [ -e %APPDATA%/OpenOffice.org2/user/basic/Standard/ ] # On Windows
+then
+ BASIC_DIR=%APPDATA%/OpenOffice.org2/user/basic/Standard/
+else
+ echo "$0 error: Sorry don't know where to install the macro to"
+ echo " - Requires OpenOffice or NeoOffice to be installed to batch convert docs to PDF"
+ echo " - This error is from installMacro.sh, fix errors or add platforms here"
+ exit -1
+fi
+
+#
+# now actually install the converted file
+#
+mv "$BASE.xba" "$BASIC_DIR"
+#
+# Append the macro file to the library of macros
+#
+grep "$BASE" "$BASIC_DIR/script.xlb" > /dev/null 2>&1 || sed -i "" -e 's;; \
+;' "$BASIC_DIR/script.xlb"
+
+
diff --git a/Scripts/setup_mail.sh b/Scripts/setup_mail.sh
new file mode 100755
index 0000000..9d1b714
--- /dev/null
+++ b/Scripts/setup_mail.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [ ! "$UID" = "0" ]
+then
+ echo "This script requires being run as root, eg: \$ sudo $0"
+ exit
+fi
+
+apt-get install bsd-mailx postfix
+
+# Setup postfix so that sending mail works
+mkfifo /var/spool/postfix/public/pickup
+cat > /etc/aliases << EOF
+# See man 5 aliases for format
+postmaster: root
+EOF
+cat > /etc/mailname << EOF
+invertedlogic.com
+EOF
+cat > /etc/postfix/main.cf << EOF
+# See /usr/share/postfix/main.cf.dist for a commented, more complete version
+smtpd_banner = $$myhostname ESMTP $$mail_name (Ubuntu)
+biff = no
+append_dot_mydomain = no
+# Uncomment the next line to generate "delayed mail" warnings
+#delay_warning_time = 4h
+readme_directory = no
+myorigin = /etc/mailname
+mydestination = localhost.localdomain, localhost
+relayhost =
+mynetworks = 127.0.0.0/8 192.168.0.0/24
+mailbox_size_limit = 51200000
+recipient_delimiter =
+inet_interfaces = all
+inet_protocols = ipv4
+EOF
+/etc/init.d/postfix restart
+
+#
+# If above for setting up postfix didn't work then do following:
+#
+# Run:
+# dpkg-reconfigure postfix
+#
+# Answer with following:
+# Type: "Internet Site"
+# System mail name: "invertedlogic.com"
+# Postmaster: "postmaster"
+# Other destinations: "localhost.localdomain, localhost"
+# Force synchronous updates: "Yes"
+# Local networks: "127.0.0.0/8 192.168.0.0/24"
+# Mailbox size limit (bytes): "51200000"
+# Local address extension character: ""
+# Internet protocols to use: "ipv4"
+#