Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Current date script.

  • Loading branch information...
commit 93372c1f313815a0cccd0bd2bdcff0d6e915caab 1 parent 4805d9d
@ccgus authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 plugins-script/Insert YYYY.MM.DD.jstalk
View
18 plugins-script/Insert YYYY.MM.DD.jstalk
@@ -0,0 +1,18 @@
+function main(windowController, document) {
+
+ var dateFormat = "YYYY.MM.dd";
+
+ var dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
+ [dateFormatter setDateFormat:dateFormat];
+
+ var t = [dateFormatter stringFromDate:[NSDate date]]);
+
+ var textView = [windowController textView];
+ var r = [textView selectedRange];
+
+ if ([textView shouldChangeTextInRange:r replacementString:t]) {
+ [[[textView textStorage] mutableString] replaceCharactersInRange:r withString:t];
+ }
+
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.