View Single Post
Old 04-07-2008, 06:02 AM   #2
kusmi
Connoisseur
kusmi began at the beginning.
 
kusmi's Avatar
 
Posts: 73
Karma: 16
Join Date: Jul 2006
Location: Zurich, Switzerland
What operating-system do you use?

I had the same problem - but had a linux-server running at home, so I configured it that way, so my iLiad automatically uploads the outbox to my linux-server (I just click the iLiad "connect" button -> it will connect to my linux-box to it's windows-share and uploads my outbox, and imports all new documents)

Then I have a cron-job (a linux script, which checks on a regular interval, e.g. 1 minute) if they are new uploaded content. If they are, I automagically convert all the pdfs+scribbles of all files in that folder using the excellent java "iLiadPDFScribbleMerger".

If you are "script-savy" I have uploaded my ruby script, which does all the conversion of the directory - it should also work on windows, if you install a ruby interpreter.

Code:
#!/usr/bin/ruby
#convertScribble.rb

require 'rexml/document'
include REXML

# check, if another script is already running... then stop it

output = `ps uxww | grep "convertScribble.rb" | grep -v "grep" | grep -v "/bin/sh"`
processes =  output.split("\n").length
puts "Running procceses "+output

if (processes > 1)
  puts "Already running, exit now"
  exit	
end
puts "Start Processing"

directories = Dir["/home/michi/iLiad/inbox/*.pdf*"]

directories.each { 
	|item|
	basename = File.basename(item)
	changeTime = File.mtime(item)
	# only execute if modification-time is larger than 1 minute:
	difference = Time.now - changeTime
	puts "Modification of file is "+difference.to_s+" seconds ago" 
	if (difference > 60)
	puts "File is old enough, start processing" 
	# extract XML description
          doc = Document.new File.new("#{item}/manifest.xml")
	  root = doc.root
	  completeDescription = root.elements["metadata/dc-metadata/Description"].text
          fileString = ""
          if (completeDescription != nil)	
	    description = completeDescription.split("\n")	
	    fileString = ""
	    description.each { |desc|
              fileString = fileString + "[" + desc + "] "
            }	
          end
      	  `cp -R "#{item}" "/home/michi/iLiad/inbox-converted/backup/"`
	  `/usr/bin/java -jar "/home/michi/iLiadConvert/iLiad Scribble Merger/ILiadPdfScribbleMerger.jar" -i:"#{item}" -o:"/home/michi/iLiad/inbox-converted/#{basename} #{fileString}Notes_Michi" -m:n -c2:#990033 -c3:#006633`
	  `rm -rf "#{item}"`
	  `chmod -R ugo+rw "/home/michi/iLiad/inbox-converted/backup/"`
	end
}
It does a bit more than just converting - it also checks, that it will not start converting until the pdfs are fully uploaded. Then when I usually scribble the PDFs on my iLiad, I add comments to the pdfs (e.g. wether I read it already, some keywords, etc) and I also include those keywords to the resulting merged PDF...

Perhaps you could adapt this script for your own needs?
kusmi is offline   Reply With Quote