Mori: Insert Date and Time (Plugin Example)

Tags ( | )

Ostensibly, this plugin is designed to serve the feature request here. It will insert into the current text field a date and/or time string that you can format from within the preferences. You can access the insert functions from the menu(keyboard shortcuts can be add through the Keyboard System Preference Pane under "Application Shortcuts.") or the toolbar.

However, the real purpose of this plugin is to serve as an example and template to others who might want to try a plugin but don’t know where to start. Sometime this weekend, I should be able to post the completed Xcode project, commented to help one write a toolbar/menu/prefpane plugin for Mori. It will not serve as an introduction to the objective-C language, but it should help one parlay any obj-c knowledge or tutorials into working plugins.

Of course, the first thing to read would be the Blocks introduction.

If anyone would like to help out, icons for “insert date” “insert time” “insert date and time” and “DateTime PrefPane” would be greatly appreciated.

Version: 1.1
AttachmentSize
DateTimeProject.zip98.33 KB
DateTime.plugin.zip26.07 KB

Thanks for tackling this it

Thanks for tackling this it work well for me... when you are ready I think it would make sense to host this plugin code in the subversion user repository. I can do that when you are ready, or you can. For those who don't know the user repository is an open subversion repository that I've setup for users to managed any contributed code.

Yes, I think all plugin code

Yes, I think all plugin code can go into the repository. But I'll probably leave a copy of the project here for those who just don't want to hassel setting up Subversion.

If anyone would like to help

If anyone would like to help out, icons for “insert date” “insert time” “insert date and time” and “DateTime PrefPane” would be greatly appreciated.

I would suggest using the toolbar icon for "Date & Time" from Hog Bay notebook. You can find the image inside Hog Bay Notebook's application package. The image is originally from the OS X system preferences.

I don't think it would be worth while to make a different toolbar item for each of date, time, and date and time. Instead I would suggest maybe just looking to see if the option or control button is held down when the toolbar button is pressed and change the behavior that way.

You're probably right about

You're probably right about this, but I had already made the three separate toolbar items by the time I had read this, and I couldn't find ready examples in Mori how to modify toolbar actions with modifier keys. Perhaps, it's best left up to an exercise to the reader (as they say in math texts.)

Don't worry about it for

Don't worry about it for now, but the way to do it is inside the action method. Just set the toolbar to send an action such as dateTimeToolbarPressed: and then inside that method look at the modifier flags on the [NSApp currentEvent].

Updated with toolbar

Updated with toolbar actions, HBN icon, and xcode project.

It probably still needs a readme file, to help someone find which changes to make if they use it as a template for their own plugin.

System Preferences pointer

Very nice, Jeff! I just tried the updated version. I only noticed two things:

1. The plugin says, "%x and %X represent the default formats as set in the Date & Time System Preference Panel." It might be more direct to refer users to the 'International' pane > 'Formats' > 'Dates' and 'Times'. The 'Date & Time' pane doesn't actually handle date & time formats.

2. Changes to the DateTime settings don't seem to be applied unless you click in a different text field in the pane. Closing Preferences doesn't make a change apply either. Perhaps there should be an Apply button?

By the way, I'm testing with 1.3b.

Thanks Joe, 1. I'll change

Thanks Joe,

1. I'll change that on the next update.

2. I think this is pretty standard for text field behavior; as long as the cursor is in the text field the edits haven't been committed. However, I can change it to update the value continuously. That way after any character is typed or deleted, that will be updated to the format preference.

Preference Pane doesn't display

The Date/Time Preference Pane used to work. But now the window is just blank.
Mori 1.6 -- is there some incompatibility or is it me?

Thanks for the help,
Linda

Does it come up if you click

Does it come up if you click another pane and then click back to the Date and Time?

I think it's the same problem that was plaguing the mGTD pane, so I can probably find it. Give me a day or two to post a fix.

Is anyone really using this plugin? I didn't think it was very popular.

Yes, it's the same

Yes, it works if I click another pane and then click back to the Date and Time.

Yes, I use it a lot to put timestamps in notes.

I appreciate very much your work with Mori and plugins even if I'm usually very quiet. ;-)

Much appreciated

Echo that. Been using the plugin constantly since day one. Many thanks for the work.

And yes, I've had the preference pane problem too.

Andy

Ok, the pref pane should be

Ok, the pref pane should be fixed now.

Can't install under Leopard

I have been using this very useful plug-in for quite some time on my old G5 tower under Tiger but can't get it to install on my new MacPro running Leopard (10.5.2).

Any ideas?

Wayne

Anyone else experiencing difficulty in Leopard?

The Install Date & Time plugin works fine for me in Mori 1.6.10 running on Leopard 10.5.2, but Wayne is still experiencing problems with it.

Who else isn't able to get the plugin to function in this configuration?

thank you BME guy i was

thank you BME guy i was looking for this plug in really thanks .

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.