Extended AppleScript for document hooks

lib.applescript with set of helper AppleScript code
Improve the shell scripts to run wihtout expecting to be a in particular directory