<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Dropzone Forums — Screenshot tool]]></title>
	<link rel="self" href="https://forums.aptonic.com/feed/atom/topic/346/" />
	<updated>2018-04-08T10:09:45Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.aptonic.com/topic/346/screenshot-tool/</id>
		<entry>
			<title type="html"><![CDATA[Re: Screenshot tool]]></title>
			<link rel="alternate" href="https://forums.aptonic.com/post/927/#p927" />
			<content type="html"><![CDATA[<p>This is really cool. There isn&#039;t an API to remove items from Drop Bar, but what about just giving each subsequent screenshot a different filename? Then you&#039;d avoid overwriting the last one each time. And the idea is you&#039;d probably drag it out of Drop Bar before capturing the next one so having multiple ones added to Drop Bar isn&#039;t really a problem.</p><p>Try the below:</p><div class="codebox"><pre><code># Dropzone Action Info
# Name: Screenshots
# Description: Take a screenshot, add it to ~/Screenshots and add to Drop Bar
# Creator: Gareth Evans
# URL: http://yoursite.com
# Events: Clicked
# KeyModifiers: Command, Option, Control, Shift
# SkipConfig: No
# RunsSandboxed: No
# Version: 1.0
# MinDropzoneVersion: 3.0

def clicked
  # Create the Screenshots directory if not already present
  system(&quot;mkdir ~/Screenshots&quot;)
  
  # Make a filename with the current time
  formatted_time = Time.now.strftime(&quot;%F at %I.%M.%S %p&quot;)
  filename = &quot;Screen Shot &quot; + formatted_time + &quot;.png&quot;
  file_path = File.expand_path(&#039;~&#039;) + &quot;/Screenshots/&quot; + filename
  
  # Capture screenshot
  system(&quot;screencapture -i \&quot;&quot; + file_path + &quot;\&quot;&quot;)
  
  # Add to Drop Bar
  $dz.add_dropbar([file_path])
  
  # Notification
  $dz.finish(&quot;Screenshot successful&quot;)
  $dz.url(false)
end</code></pre></div><p>Also, could I recommend you fork the <a href="https://github.com/aptonic/dropzone3-actions">https://github.com/aptonic/dropzone3-actions</a> repository, add your action and send me a pull request? That will make your action show up at <a href="https://aptonic.com/actions/untested">https://aptonic.com/actions/untested</a> automatically which will allow others to install it. </p><p>This will also allow us to collaborate on improvements more easily <img src="https://forums.aptonic.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[John]]></name>
				<uri>https://forums.aptonic.com/user/2/</uri>
			</author>
			<updated>2018-04-08T10:09:45Z</updated>
			<id>https://forums.aptonic.com/post/927/#p927</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Screenshot tool]]></title>
			<link rel="alternate" href="https://forums.aptonic.com/post/926/#p926" />
			<content type="html"><![CDATA[<p>Hello, </p><p>I&#039;ve managed to create a simple screenshot plugin using the &#039;screencapture&#039; command in OS X, </p><p>It&#039;s early days, but thought I&#039;d share what&#039;s going on so far:</p><p># Dropzone Action Info<br /># Name: Screenshots<br /># Description: Take a screenshot, add it to ~/Screenshots and add to Drop Bar<br /># Creator: Gareth Evans<br /># URL: <a href="http://yoursite.com">http://yoursite.com</a><br /># Events: Clicked<br /># KeyModifiers: Command, Option, Control, Shift<br /># SkipConfig: No<br /># RunsSandboxed: No<br /># Version: 1.0<br /># MinDropzoneVersion: 3.0</p><p>def clicked<br /># Create the Screenshots directory if not already present<br />&nbsp; system(&quot;mkdir ~/Screenshots&quot;)<br /># Capture screenshot.png to the directory<br />&nbsp; system(&quot;screencapture -i ~/Screenshots/screenshot.png&quot;)<br />&nbsp; file_paths = [File.expand_path(&#039;~&#039;) + &quot;/Screenshots/screenshot.png&quot;]&nbsp; <br />&nbsp; $dz.add_dropbar(file_paths)<br /># Notification<br />&nbsp; $dz.finish(&quot;Screenshot successful&quot;)<br />&nbsp; $dz.url(false)<br />end</p><p>My biggest hurdle is when you take a second screenshot, it looks like there are two files in the drop bar, but both icons point to the same screenshot.png, </p><p>Does anybody know if there is a dz.remove command in the API so I can put it above the dz.add command, ensuring there is only ever one icon in the Drop Bar.</p><p>Also, if there&#039;s an easier way to approach this I&#039;m all ears <img src="https://forums.aptonic.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[garevans]]></name>
				<uri>https://forums.aptonic.com/user/14981/</uri>
			</author>
			<updated>2018-04-07T14:22:57Z</updated>
			<id>https://forums.aptonic.com/post/926/#p926</id>
		</entry>
</feed>
