Thank you very much for this script. Though it doesn't do exactly what I've intended it is a great help for me. Now I can start tinkering by my own ;-)
My idea was to add an additional script named 'Name Backup now' to the AppleScript Menu. Your source helps me a lot with the basics like creating the filename (I didn't knew how to use phrases like 'do shell script...' or 'POSIX path' in an AppleScript) To be honest - I've written 2 little scripts before (under MacOS9). Harald On Oct 9, 11:12 am, Maarten Sneep <[EMAIL PROTECTED]> wrote: > On 9 okt 2008, at 10:26, hkrems wrote: > > > Maybe I can do what I want to do using an AppleScript that adds a > > date- > > and-time-stamp to the filename? > > (* Save a copy of the unmodified file upon save. > Usage: save this in a compiled AppleScript under the name > "File•Save.scpt" > in ~/Library/Application Support/BBEdit/Menu Scripts/ > > Upon save it will copy the old version to a new file with the date & > time of > the save action appended. Note that this is not the modification time > and > date of said file, but rather that of the _next_ save, you can modify > the script > yourself if you want to. > > Hope this is helpful. *) > > on menuselect(menuName, itemName) > if menuName = "File" and itemName = "Save" then > set makeCopy to false > tell application "BBEdit" > if on disk of document 1 and modified of document 1 > and modifiable > of document 1 then > -- document has been saved before > set theFile to file of document 1 > set makeCopy to true > end if > end tell > tell application "Finder" > if makeCopy then > set theExt to name extension of theFile > set thePath to POSIX path of theFile > set theDateTime to do shell script "date > +'%Y%m%d-%H%M%S.'" > set theName to do shell script "basename " & > quoted form of > thePath & " " & theExt > set theDir to do shell script "dirname " & > quoted form of thePath > set theNewName to theName & theDateTime & > theExt > do shell script "cp " & quoted form of POSIX > path of theFile & " " > & quoted form of (theDir & "/" & theNewName) > end if > end tell > end if > return false -- alsways return false so BBEdit saves normally > end menuselect --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a specific feature request or would like to report a suspected (or confirmed) problem with the software, please email to "[EMAIL PROTECTED]" rather than posting to the group. -~----------~----~----~----~------~----~------~--~---