Spotlight | Reviews | Current Issue | Academy | Newsletter | Subscribe | Shop |
Departments

Partner Links
Make your own website
WinWeb OnlineOffice
Comparing prices of hardware is worth it.
Price Comparison
What:
Where:
Country:
vacatures Netherlands njobs Linux vacatures
arbeit Deutschland njobs Linux arbeit
work United Kingdom njobs Linux jobs
Lavoro Italia njobs Linux lavoro
Emploi France njobs Linux emploi
trabajo Espana njobs Linux trabajo

user friendly

Admin Magazine

ADMIN Network & Security

Subscribe now and save!

 ADMIN - Explore the new world of system administration! ADMIN is a smart, technical magazine for IT pros on heterogeneous networks. Each issue delivers technical solutions to the real-world problems you face every day. Learn the latest techniques for better:

  • network security
  • system management
  • troubleshooting
  • performance tuning
  • virtualization
  • cloud computing

 on Windows, Linux, Solaris, and popular varieties of Unix.

http://www.admin-magazine.com/

  linux-magazine.com » Online » Blogs » Productivity Sauce » Create a Simple Scratchpad with Autokey  

Productivity Sauce
Productivity Sauce

Create a Simple Scratchpad with Autokey

A plain text file acting as a scratchpad can come in handy in many situations. You can use it to store text and code snippets, links, and other useful stuff. But copying and pasting text fragments into a text file manually is not the most sensible way to go. A simple script based on the AutoKey utility can solve the problem. AutoKey can handle Python scripts, and it has its own API which makes it supremely easy to create interactive scripts. The script itself is not particularly complicated:

snip = clipboard.get_selection()
retCode, note = dialog.input_dialog("Note", "Enter note") 

filename = '/home/dmpop/Documents/Snips/snips.txt'
file = open(filename, 'a')
file.write(note+": "+snip+"\n\n")
file.close()

First, the script grabs the contents of the clipboard and prompts you to enter a short note that describes the new entry. It then opens the snipx.txt file and appends the description and the clipboard contents.

I use the script for storing links, so I also added the following code block that saves the contents in the snips.html file formatted as a simple link list.

filename = '/home/dmpop/Documents/Snips/snips.html'
file = open(filename, 'a')
file.write(note + ": <a href=\""+snip+"\">"+snip+"</a><br> \n")
file.close()

I enabled synchronization for the Documents folder via the Ubuntu One server, so I can access my scratchpad file and link list from multiple machines and via a browser.

Comments


Print this page. Recommend
Share