Tiny Core Base > TCB Q&A Forum

Screenshot- Possible to set 'saved to' File-name?

(1/2) > >>

Excuse a simple-minded question.
When taking a screenshot, is there a way to set the file-name the image is saved to at the time the image is made?
I know I can rename the file later; just wondering if I can avoid having to copy and type (correctly) the 10 digit number the  screenshot utility uses.

Thanks in advance.

Well, the menu item 'ScreenShot' calls in the end '/usr/local/bin/screenshot.sh', which is just a wrapper script around a call of 'imlib2_grab FILENAME.EXT' (with EXT something like 'png', 'jpg', 'ppm' or 'bmp'). 

Hi newtotinycore
You could try modifying the  /usr/bin/screenshot.sh  script to look like:

--- Code: ---#!/bin/sh
[ -z ${DISPLAY} ] && echo "Requires X" &&  exit 1
editor /tmp/savename.txt
filename=`cat /tmp/savename.txt`.png
/bin/sh -c "sleep 1 && /usr/bin/imlib2_grab $filename"                         
exec popup "Screenshot saved to $HOME/$filename"
--- End code ---
When you take a screenshot, the editor will open. Type the filename you want, NO extension and NO carriage return.
Click the editors close button, click Save.  You will find  filename.png in your home directory. If you want the change
to survive a reboot, add the line   usr/bin/screenshot.sh   to your   /opt/.filetool.lst   file.

Thanks Maro for telling me the complete path : /usr/local/bin/screenshot.sh. It doesn't take much to throw me off course.

And thanks for the complete explanation, Rich; works great!
Looking at the code was very helpful.

In case any other newbies are interested in this change, on my system what works is:
filename=`cat /tmp/savename.txt  "+%d"`.png

                 Trying same modification to screenshot.sh in tinycore 4.3 that worked in 4.1.
                 When I try to save changes to screenshot.sh, get message "Error writing to file 'screenshot':
                 Read-only file system."
                 Tried opening file with sudo and using chmod on screenshot.sh and link under /tmp/tcloop..., also tried sudo su and then chown.
                 No luck, still read only file system.
                 Maybe it's not worth trying to change screenshot behavior- but I am curious if I messed up when installing 4.3 to USB.
                 I used ext 2.

                Thanks for any pointers.


[0] Message Index

[#] Next page

Go to full version