
If you are in any way security and privacy minded this should raise your hairs. With AppleScript, you may even be able to create and change data in the target applications. With AppleEvents (or AppleScript commands) you can often retrieve valuable information from other applications that would be difficult or even impossible, to get any other way. Because of this it should be a part of your ‘MacAdmin Toolbelt.’ĪppleScript’s strength lies in inter-application communication. Even though it probably is not (and shouldn’t be) the first tool of choice for many tasks, there are some tasks that AppleScript makes very simple.
BBEDIT CREATE APPLESCRIPT PRO
BBEDIT CREATE APPLESCRIPT HOW TO
I'm just a little lost as to how to get the above code to execute on file creation. Set selection to ((current date) as string) Select insertion point after (last character) I have this code that I've tried running by itself, and it works fine: tell application "BBEdit"
BBEDIT CREATE APPLESCRIPT TRIAL
I've never done applescript before so it's a little trial and error. I could also try adding some scripts into the startup folder, but I'm not sure how I would go about say, adding a date to all open documents.

I don't know if any of those really fit, though. documentDidLock: called when BBEdit has successfully made a document readonly.documentWillLock: called when BBEdit is going to make a document read-only.documentDidUnlock: called when BBEdit has successfully made a document.(For example, when you click the pencil to unlock a document) documentWillUnlock: called when BBEdit is going to make a document writeable.documentDidSave: called after a document has been saved successfully.(note that this will only be called after a successful return from a documentWillSave: called when the application is about to begin saving aĭocument.documentShouldSave: called when the application is trying to determine whether a given document should be saved.documentDidClose: called when the application has closed a document.documentShouldClose: called when the application is preparing to close a.(Since BBEdit supports multiple types of documents, your script should allow for the argument to be a document of any type.) documentDidOpen: called when a document has been opened and is ready for use.applicationWillSwitchOut: called when BBEdit is being put into the background.applicationDidSwitchIn: called when BBEdit has been brought to the foreground.applicationDidQuit: called when the application has finished shutting down and is about to exit.Receives a ‘quit’ event for any other reason). applicationShouldQuit: called when you choose the Quit (or the application.applicationDidFinishLaunching: called when the application has completed.I also found these relevant hooks from the BB docs: I found the following page which was a good starting point:

However, none of the listed events seem quite right, and I don't really want to add dates to existing documents. I read some of the documentation on BB and I think that attaching some Applescript to an event might be the way to go. I'm new to BBEdit but I really like Textwrangler and have used it for years. I would like this to be automatic so that I don't have to remember to run a script each time. I open a lot of new documents in Textwrangler/BBedit and I would like them to always have the date printed at the top.
