snipt

Ctrl+h for KB shortcuts

AppleScript

Clipboard to OmniFocus Inbox

1
2
3
4
5
6
7
8
set OFTask to the clipboard

tell application "OmniFocus"
	set theDoc to first document
	tell theDoc
		make new inbox task with properties {name:OFTask}
	end tell
end tell
https://snipt.net/embed/f6083d64a7fdbb241dce3ea24d7cd7f5/
https://snipt.net/raw/f6083d64a7fdbb241dce3ea24d7cd7f5/
f6083d64a7fdbb241dce3ea24d7cd7f5
applescript
AppleScript
8
2016-09-24T08:10:02
True
False
False
Aug 31, 2012 at 10:10 AM
/api/public/snipt/46560/
clipboard-to-omnifocus-inbox
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">set</span> <span class="nv">OFTask</span> <span class="k">to</span> <span class="nb">the clipboard</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">tell</span> <span class="nb">application</span> <span class="s2">&quot;OmniFocus&quot;</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">set</span> <span class="nv">theDoc</span> <span class="k">to</span> <span class="nb">first</span> <span class="na">document</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">tell</span> <span class="nv">theDoc</span> </span><span id="L-6"><a name="L-6"></a> <span class="nb">make</span> <span class="nb">new</span> <span class="nv">inbox</span> <span class="nv">task</span> <span class="nv">with</span> <span class="na">properties</span> <span class="p">{</span><span class="na">name</span><span class="p">:</span><span class="nv">OFTask</span><span class="p">}</span> </span><span id="L-7"><a name="L-7"></a> <span class="k">end</span> <span class="k">tell</span> </span><span id="L-8"><a name="L-8"></a><span class="k">end</span> <span class="k">tell</span> </span></pre></div> </td></tr></table>
applescript, clipboard, omnifocus

Java

java clipboard access

this.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
this.clipboard.addFlavorListener(new FlavorListener() {...});
https://snipt.net/embed/6e81f1621d8c050f4f581252876d2d8f/
https://snipt.net/raw/6e81f1621d8c050f4f581252876d2d8f/
6e81f1621d8c050f4f581252876d2d8f
java
Java
2
2016-09-22T19:26:22
True
False
False
/api/public/snipt/24128/
java-clipboard-access
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">this</span><span class="o">.</span><span class="na">clipboard</span> <span class="o">=</span> <span class="n">Toolkit</span><span class="o">.</span><span class="na">getDefaultToolkit</span><span class="o">().</span><span class="na">getSystemClipboard</span><span class="o">();</span> </span><span id="L-2"><a name="L-2"></a><span class="k">this</span><span class="o">.</span><span class="na">clipboard</span><span class="o">.</span><span class="na">addFlavorListener</span><span class="o">(</span><span class="k">new</span> <span class="n">FlavorListener</span><span class="o">()</span> <span class="o">{...});</span> </span></pre></div> </td></tr></table>
access, clipboard, java, listener, memory

AppleScript

Clipboard to plain text

1
2
3
4
5
try
	set the clipboard to string of (the clipboard as record)
on error errMsg
	display dialog errMsg
end try
https://snipt.net/embed/33f0a30e463d1757d25513119f2c45ee/
https://snipt.net/raw/33f0a30e463d1757d25513119f2c45ee/
33f0a30e463d1757d25513119f2c45ee
applescript
AppleScript
5
2016-09-19T02:42:45
True
False
False
/api/public/snipt/7973/
clipboard-to-plain-text
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">try</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">set the clipboard to</span> <span class="nv">string</span> <span class="k">of</span> <span class="p">(</span><span class="nb">the clipboard</span> <span class="k">as</span> <span class="nv">record</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a><span class="k">on</span> <span class="k">error</span> <span class="nv">errMsg</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">display dialog</span> <span class="nv">errMsg</span> </span><span id="L-5"><a name="L-5"></a><span class="k">end</span> <span class="k">try</span> </span></pre></div> </td></tr></table>
applescript, clipboard, plaintext

JavaScript

copy to clipboard

1
2
3
4
5
6
function copyToClipBoard(id)
{
    document.getElementById('holdtext').innerText = document.getElementById(id).innerText;
    Copied = document.getElementById('holdtext').createTextRange();
    Copied.execCommand("Copy");
}
https://snipt.net/embed/38519f215179b47ca24a1e437947a4ed/
https://snipt.net/raw/38519f215179b47ca24a1e437947a4ed/
38519f215179b47ca24a1e437947a4ed
js
JavaScript
6
2016-09-25T02:11:55
True
False
False
/api/public/snipt/2969/
copy-to-clipboard-1
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="kd">function</span> <span class="nx">copyToClipBoard</span><span class="p">(</span><span class="nx">id</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a><span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">&#39;holdtext&#39;</span><span class="p">).</span><span class="nx">innerText</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">id</span><span class="p">).</span><span class="nx">innerText</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">Copied</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">&#39;holdtext&#39;</span><span class="p">).</span><span class="nx">createTextRange</span><span class="p">();</span> </span><span id="L-5"><a name="L-5"></a> <span class="nx">Copied</span><span class="p">.</span><span class="nx">execCommand</span><span class="p">(</span><span class="s2">&quot;Copy&quot;</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
clipboard, javascript
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.