Results 1 to 5 of 5

Thread: Short Script Puzzle

  1. #1
    Join Date
    Jun 2013
    Location
    Sydney
    Beans
    133
    Distro
    Lubuntu

    Short Script Puzzle

    Trying to write a short script to capture a screen window using scrot launched via a [DeskTop Entry] icon on the desktop.

    The following works fine from the command line in terminal:
    Code:
       scrot -s /home/john/Pictures/desktop.jpg
    ]The following does not work in a script:
    Code:
       #!/bin/bash
       scrot -s /home/john/Pictures/desktop.jpg
    Tried all sorts of variations and did some searching, but it puzzles me.
    As far as I know, PATH and Permissions are correct.
    The command line version waits for at least a minute for the cursor to define the required window.
    The script takes several seconds to terminate, then nothing.
    Very similar scripts to map keyboard keys work fine.

    What am I doing wrong ?
    John.

  2. #2
    Join Date
    Jun 2016
    Beans
    1,864
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: Short Script Puzzle

    This fixes the problem for me -
    Code:
    [Desktop Entry]
    Type=Application
    Name=screen shot
    Comment=Capture a screen window
    Exec=sh -c 'sleep 0.1;scrot -s /home/john/Pictures/desktop.jpg'
    Icon=camera-photo
    Terminal=false
    StartupNotify=false
    Xubuntu 18.04/MacBookPro9,1 ♦ openSUSE Tumbleweed/Debian 10/Xubuntu/VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  3. #3
    Join Date
    Jun 2013
    Location
    Sydney
    Beans
    133
    Distro
    Lubuntu

    Re: Short Script Puzzle

    halogen2,
    Thanks for the code, it works a treat.
    Now I have to understand how it works, including following up the reference to an Arch forum - thanks.
    John

  4. #4
    Join Date
    Jul 2018
    Beans
    10

    Re: Short Script Puzzle

    Quote Originally Posted by electrosteam View Post
    halogen2,
    Thanks for the code, it works a treat.
    Now I have to understand how it works, including following up the reference to an Arch forum - thanks.
    John
    Great!!

  5. #5
    Join Date
    May 2007
    Location
    San Francisco, California
    Beans
    5,857
    Distro
    Ubuntu Development Release

    Re: Short Script Puzzle

    Heh, brings back memories for me trying to find it one week like 5 years ago. Thanks for this, was looking for something similar last week!

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
  •