Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Periodic screenshot utility.

  1. #11
    Join Date
    May 2012
    Location
    +961
    Beans
    42
    Distro
    Xubuntu 12.04 Precise Pangolin

    Up.

    ...

  2. #12
    scouser73's Avatar
    scouser73 is offline Iced Blended Vanilla Crème Ubuntu
    Join Date
    Mar 2008
    Beans
    1,663
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Wink Re: Periodic screenshot utility.

    Ubuntu Forum DO's and DON'T's

    DON'T

    8 Bump your posts too often (around once every 24 hours is recommended)

    http://ubuntuforums.org/showthread.php?t=885580

  3. #13
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Periodic screenshot utility.

    how about putting it before/after -window root switch/value combo, inside ()?

    command line tools usually go like this

    Code:
    command_name -option1 value1 -option2 value2 ... file(s)/folder(s)
    what is available: import --help
    Last edited by Vaphell; May 14th, 2012 at 04:56 PM.

  4. #14
    Join Date
    May 2012
    Location
    +961
    Beans
    42
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Periodic screenshot utility.

    I can't understand how to put it.

    Are you able to fix the script I wrote just in the previous post ? That will be easier.
    If not, explain further.


    Thanks.

  5. #15
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: The quality's still the highest.

    Code:
    import -window root -quality N $screenshot_dir/screenshot-$(date +%M_%k_%d_%m_%Y|sed -e 's/^ *//').png

  6. #16
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: Periodic screenshot utility.

    just save this wherever you want to run it from. it will store your images in $HOME/Pictures/Screenshots/<date>/<time>.png
    Code:
    #!/bin/bash
    # declare variables
    delay=20 				# seconds to delay
    basefolder=$HOME/Pictures/Screenshots	# our main screenshot folder
    
    # create our basefolder if it doesn't exist
    if [ ! -d $basefolder ]; then
     mkdir $basefolder
    fi
    # move into it
    cd $basefolder
    
    # meat n pooptatoes
    while :
    do
     currentdate="$(date +%x)"
     if [ ! "$reference" = "$currentdate" ]; then
       mkdir $currentdate
       reference="$currentdate"
       shotfolder="$basefolder/$currentdate"
       if [ ! -d "$shotfolder" ]; then
         mkdir $shotfolder
       fi
     fi
     currenttime="$(date +%X)"
     import -quality 5 -window root $shotfolder/$currenttime.png
     sleep $delay
    done

  7. #17
    Join Date
    May 2012
    Location
    +961
    Beans
    42
    Distro
    Xubuntu 12.04 Precise Pangolin

    Talking Done, thanks y'all.

    Well, HilmTye, I'm sorry to tell you that the script you've written didn't work, it has just created a "Screenshot" folder within the Pictures folder, containing three sub-folders, the first one having the date day, the second named as the current month, and the last folder named "2012". That's fine, but add to it that no screen-shots were being token.
    I'm sorry for that, hope I didn't waste much of your time.

    After re-reading my script, I understood how Vaphell has put the script, and here's how my script looks like now and it's working as expected:

    screenshot_dir='screens'
    seconds='30';
    if [ ! -d "$screenshot_dir" ]; then
    mkdir $screenshot_dir;
    fi
    while [ 1 ]; do
    sleep $seconds;
    (import -window root -quality 3 $screenshot_dir/screenshot-$(date +%S_%M_%k_%d_%m_%Y|sed -e 's/^ *//').jpg) &
    done


    Thanks to everyone who helped be going through my issue.

  8. #18
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: Periodic screenshot utility.

    sorry about that, I didn't actually test it and as a result, neglected quotes in the filename. if you're interested in it, here is the script, fixed:

    Code:
    #!/bin/bash
    # declare variables
    delay=20 				# seconds to delay
    basefolder=$HOME/Pictures/Screenshots	# our main screenshot folder
    extension=.png				# the extension we want to use
    quality=5				# image quality
    
    # create our basefolder if it doesn't exist
    if [ ! -d $basefolder ]; then
     mkdir $basefolder
    fi
    # move into it
    cd $basefolder
    
    # meat n pooptatoes
    while :
    do
     currentdate="$(date +%x)"
     if [ ! "$reference" = "$currentdate" ]; then
       reference="$currentdate"
       shotfolder="$basefolder/$currentdate"
       if [ ! -d "$shotfolder" ]; then
         mkdir $shotfolder
       fi
     fi
     currenttime="$(date +%X)"
     import -quality $quality -window root "$shotfolder/$currenttime$extension"
     sleep $delay
    done
    the advantage to this script is that each day will have its' own folder (and is automagically created by the script on a new day) with the filenames simply being the time and the extension

    as you can see, it works:
    Screenshot at 2012-05-15 05:35:58.jpg

    if you would like it edited so that, for instance, they are separated by hour into separate folders or whatever, just let me know. right now if you leave it running from midnight to midnight you will end up with a folder that has 4320 images inside it (with a 20 second interval)
    Last edited by HiImTye; May 15th, 2012 at 01:43 PM.

  9. #19
    Join Date
    May 2012
    Location
    +961
    Beans
    42
    Distro
    Xubuntu 12.04 Precise Pangolin

    Smile Re: Periodic screenshot utility.

    Oh, lucky I came back to this thread.

    Thanks for the script, I just saved it and I will use it whenever I find it necessary !

  10. #20
    Join Date
    May 2012
    Location
    +961
    Beans
    42
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Periodic screenshot utility.

    Hey guys, sorry for having to Up this topic, but it's not as old and I need to add something to it:

    Can I modify the screen-shot file name to the focused window ? I can't explain much so here's a photo to make things clearer:




    Last edited by UAdnan; May 28th, 2012 at 09:26 AM. Reason: Modified issue.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •