Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Russell Adams <RLAdams <at> AdamsInfoServ.Com>
Subject: Re: [Orgmode] Automatic screenshot insertion
Newsgroups: gmane.emacs.orgmode
Date: Tuesday 29th March 2011 14:43:27 UTC (over 6 years ago)
On Sun, Nov 28, 2010 at 08:35:23PM +0100, David Maus wrote:
> At Thu, 18 Nov 2010 18:16:22 +0100,
> Jonathan BISSON wrote:
> >
> > Here is a little function that allows a user to insert a screenshot
> > easily. Only works on unix-like systems where ImageMagick is installed
> > (adapt "import" to your screenshot program if needed).
> >
>
> Nice.  Do you mind of I put the function on Org mode'S wiki (Worg) in
> the "Org hacks" page?[1]
>
> Best,
>   -- David
>
> [1] http://orgmode.org/worg/org-hacks.php
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... [email protected]
> Email..... [email protected]

I made a minor change. File names are now generated by using the
current org buffer filename, plus the date and time, and a unique
number. This allows me to sort out the images better.

                          (defun org-screenshot ()
                            "Take a screenshot into a time stamped
unique-named file in the same directory as the org-buffer and insert a link
to this file."
                            (interactive)
                            (setq filename
                                  (concat
                                   (make-temp-name
                                    (concat (buffer-file-name)
                                            "_"
                                            (format-time-string
"%Y%m%d_%H%M%S_")) ) ".png"))
                            (call-process "import" nil nil nil filename)
                            (insert (concat "[[" filename "]]"))
                            (org-display-inline-images))


------------------------------------------------------------------
Russell Adams                            [email protected]

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
 
CD: 3ms