Skip to content

Instantly share code, notes, and snippets.

@jsmm
Created October 23, 2013 22:47
Show Gist options
  • Save jsmm/7128203 to your computer and use it in GitHub Desktop.
Save jsmm/7128203 to your computer and use it in GitHub Desktop.
tell application "Google Chrome"
tell front window
set theClip to active tab execute javascript "(function(){clip = window.getSelection();
url = location.href;
var brackets = \"\\[\\[\";
var myDate = new Date();
var year = myDate.getFullYear();
var month = myDate.getMonth();
if(month < = 9)
month = month + 1
month = '0'+month;
var day= myDate.getDate();
if(day < = 9)
day = '0'+day;
var prettyDate = year +'-'+ month +'-'+ day;
var minutes = myDate.getMinutes();
if(minutes < = 9)
minutes = '0' + minutes;
var hours = myDate.getHours();
if(hours < = 9)
hours = '0' + hours;
theFinalString = clip + \" (\" + url + \" - \" + brackets + prettyDate + \"]] \" + hours + \":\" + minutes + \")\";
return theFinalString;}());"
end tell
set the clipboard to theClip
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment