📜 ⬆️ ⬇️

Own screen sharing service (on the knee in 20 minutes)

Good day% habr%

Working in the JIRA / Redmine / basecamp / Wiki is, the usual way to insert an image :! Http: //blah.com/img.png! But free services, to one degree or another, make it impossible to work effectively.

Clip2net, for example, does not give a direct link to the file, and it takes time to uproot it from the page, if there are 20 screenshots in the taskbar and each one needs a URL ...
')
Gyazo on a free account is limited in time of use, the URL has to be modified by adding ".png" at the end, the pictures have a limited shelf life, and the gyazo ad for which it is already difficult to find the screen itself is nothing.

The idea to use Dropbox pushed this comment . The idea seemed interesting to me and I sat down at my bike. DIY implementation of the “service” and the client part, with its pluses and minuses, under the cut.



Requirements



Logics



Instruments



Setup is done by editing the config.ini in the program directory:
config.ini
[MAIN] ;     DBOX_DIR = "C:\Dropbox\Public\pic\" ;      CAP = "C:\Program Files\MiniCap\MiniCap.exe" ;    (    Dropbox) ;  http://dl.dropbox.com/u/2058666/pic/1c40b047e22875c8396b029b00ea9a14.png DBOX_URL = "http://dl.dropbox.com/u/2058666/pic/" ; hotkey     shoot_key = "{PRINTSCREEN}" 


Actually, the AutoIT script:
BoxShoot.au3
 #include <Crypt.au3> $hotkey = IniRead("config.ini", "MAIN", "shoot_key", "NotFound") $DBOX_DIR = IniRead("config.ini", "MAIN", "DBOX_DIR", "NotFound") $DBOX_URL = IniRead("config.ini", "MAIN", "DBOX_URL", "NotFound") $CAP = IniRead("config.ini", "MAIN", "CAP", "NotFound") HotKeySet ( $hotkey, "SHOOT" ) TraySetToolTip("BoxShoot") Opt("TrayMenuMode", 1) $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $exititem CLOSE() EndSelect WEnd Func SHOOT() $CurTime = @YEAR & "_" & @MON & "_" & @MDAY & "_" & @HOUR & "_" & @MIN & "_" & @SEC $hash = _Crypt_HashData($CurTime, $CALG_MD5) $result = StringTrimLeft($hash, 2) $fname = $result & ".png" $fname = StringLower($fname) Run($CAP & " -captureregselect -exit -compress 7 -bordershadow -noaero -save " & $DBOX_DIR & $fname , "", @SW_MINIMIZE) ClipPut($DBOX_URL & $fname) EndFunc Func CLOSE() Exit 0 EndFunc 

After starting, the program hangs in the tray, waiting for the PrintScreen to be pressed.

Holds in memory 1.5mb

Auto start - in manual mode, that is, through the creation of a label in the "Start - Startup"


Statistics



Files: ~ 400
Volume: ~ 17mb
I have been using it since October 31

It suits me almost completely, the links do not look very nice, I'm thinking of screwing the URL shortener.

Bonus


Using scrot, xclip and a little bash scripting - you can easily get an analogue for your favorite * nix:
 #!/bin/bash F_NAME=`date +%s | md5sum | awk '{ print $1}'`'.png' DBOX_DIR='/home/username/Dropbox/Public/pic/' DBOX_URL='http://dl.dropbox.com/u/2058666/pic/' S_NAME=$DBOX_DIR$F_NAME scrot -s -q 0 $S_NAME echo -n $DBOX_URL$F_NAME | xclip 

It remains to XBindKeys screw.

Source code and ready-made exe are available on GitHub

PS


DropBox ID changed for security reasons, I apologize to the poor thing whose ID is in the scripts.

Source: https://habr.com/ru/post/133495/


All Articles