Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Prevent accidental overwriting of web receipts files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Prevent accidental overwriting of web receipts files
Authored by: Kapila on Sep 09, '09 06:25:11AM
Tip for those who know a bit of Python and Terminal/vi:
  1. Open the following file in vi
    vi "/Library/PDF Services/Save PDF to Web Receipts Folder.pdfworkflow/Contents/Tool"
  2. Change the following Python code:
    import sys
    
    def safeFilename(filename):
        filename = filename.lstrip('.')
        filename = filename.replace(os.path.sep, '-')
        if len(filename) == 0:
            filename = "Untitled"
        elif len(filename) > 245:
            filename = filename[0:245]
        return filename
    
    to be:
    import sys
    import datetime
    
    def safeFilename(filename):
        filename = filename.lstrip('.')
        filename = filename.replace(os.path.sep, '-')
        if len(filename) == 0:
            filename = "Untitled"
        elif len(filename) > 200:
            filename = filename[0:200]
    
        now = datetime.datetime.now()
        stamp = now.strftime("_%Y%m%d_%H%M%S")
        return filename + stamp
    


[ Reply to This | # ]