SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-02-08 15:04:15

ali
#! Die Hard
Registered: 2010-05-31
Posts: 1,034

scrot-x

here's a script i made to save my screenshots with a 4 digit number format
instead of having the file called "2011-02-08-185951_1366x768_scrot.png" it will rename it to "0001.png, 0002.png...9999.png"

#! /bin/bash
number=`sed -n "17 p" "$0"`
keep=$number
delay=0$1
if [ $delay -lt 1 ];
then
delay=0
fi
len=${#number}
while [ $len -lt 4 ];
do
number=0$number
len=$(($len+1))
done
scrot $number'.png' -d $delay -e 'mv $f ~/images/ & viewnior ~/images/$f' | sed -i "17s/$keep/$(($keep + 1))/" ~/bin/scripts/scrot-x
exit
1

for the script to work you must place it in ~/bin/scripts/scrot-x (or if you change that location make sure to change it in the script as well
after you place the script in ~/bin/scripts/scrot-x make sure you chmod +x it and create a symbolic link to /usr/bin

sudo ln -s ~/bin/scripts/scrot-x /usr/bin/scrot-x

now just run scrot-x to save a screenshot or scrot-x [number] for a delayed screenshot smile

to bind it to your keys

    <keybind key="Print">
      <action name="Execute">
        <execute>scrot-x</execute>
      </action>
    </keybind>
    <keybind key="A-Print">
      <action name="Execute">
        <execute>scrot-x 10</execute>
      </action>
    </keybind>

Last edited by ali (2011-02-09 07:32:35)

Offline

Be excellent to each other!

#2 2011-02-08 16:19:57

luc
#! Die Hard
From: Munich, Germany
Registered: 2010-03-21
Posts: 561

Re: scrot-x

did you try to replace

~/bin/scripts/scrot-x

with (use quotes to handle spaces in the variable)

"$0"

inside the script? should work even if you rename or move your script smile

Offline

#3 2011-02-08 16:51:03

ali
#! Die Hard
Registered: 2010-05-31
Posts: 1,034

Re: scrot-x

luc wrote:

did you try to replace

~/bin/scripts/scrot-x

with (use quotes to handle spaces in the variable)

"$0"

inside the script? should work even if you rename or move your script smile

nice!
it doesn't seam to work on my second expression

Last edited by ali (2011-02-09 07:31:33)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo