Keyboard Shortcuts, are they a possibility with ScreenGrab?

110 views
Skip to first unread message

awarner20

unread,
Dec 29, 2008, 9:25:24 AM12/29/08
to screengrab
First of all, I just found this great utility, thank you Andy for
creating it! My question above stands...is there any interest in
offering keyboard shortcut functionality?

Thanks for your time,


Adam

boole

unread,
Jan 7, 2009, 1:24:49 PM1/7/09
to screengrab
Hey mate if you really want a screenshot and cannot wait for official
response (I have almost waited a year), you can quickly add a keyboard
shortcut to the Save Visible Portion Function like this:

Find screengrab.jar in your (for WinXP: %appdata%\Mozilla\Firefox
\Profiles\XXXXXXXX.default) Firefox profile, mine is in:
C:\Documents and Settings\geo\Application Data\Mozilla\Firefox\Profiles
\kmdmxac4.default\extensions\{02450954-cdd9-410f-b1da-
db804e18c671}\chrome\screengrab.jar

Backup the file somewhere, desktop is convenient for now.

Open the JAR file in WinRAR
Pull out the screengrabOverlay.xul and open it in a text editor
Go down to here:

<menu id="screengrab-save" label="&screengrab.save;">
<menupopup>

and insert this under it:

<keyset>
<key id="grab-key" modifiers="control alt" key="S"
oncommand="Screengrab.grabVisibleDocument();"/>
</keyset>

Then look down three lines to this:

<menuitem id="pop-grabViewPort"
label="&screengrab.visible.portion.of.page;"
oncommand="Screengrab.grabVisibleDocument();"/>

and simply add this to that tag: key="grab-key"

so it looks like this:

<menuitem id="pop-grabViewPort"
label="&screengrab.visible.portion.of.page;"
oncommand="Screengrab.grabVisibleDocument();"
key="grab-key"/>

Then save and drag your screengrabOverlay.xul back into the open JAR
file, WinRAR will be able to add & replace files into it, just do it.

You will at least have to re-open firefox, I had ff closed while
editing it.

Then hit ctrl+alt+s and you should see the save dialog, you can alter
which hot key and which funtion it triggers by changing that XUL stuff
around, and last year (in march) I actually modified the javascript so
that it would not pop the save dialog up and just save PNG straight to
a hard coded location, of course I have lost those changes since then
and will have to try that tonight becuase I need to use it again to
grab a load of shots for a morgue file..

..the code modifications took me a while lol but I will post back if
you're interested in that, still, if you are scared/lazy to do any of
this, tell me what you want like what format, what folder, what hotkey
and which grab function and I can probably build you a custom
screengrab.jar... long way around but it will work.

HTH
George.

boole

unread,
Jan 7, 2009, 1:57:44 PM1/7/09
to screengrab
meh turns out quick and dirty wasnt as hard as I thought, I guess it
was the nsilocalfile thing which had me reading up alot last year but
found an example of initialising one so that was easy this time,
basically you got to edit NSGrab.js out of the JAR and update it like
you did with the XUL, this line is what you want, bear in mind it will
effect any operation which uses the save dialog in ScreenGrab, so any
save operation will save to the default location below without asking
you:

NsGrab.js Line: 81, get yours looking like this, and with one ctrl
+shift+s your file will be in that path below...
saveToFile : function(dataUrl, format) {
//var nsFile = SGNsUtils.askUserForFile
(Screengrab.defaultFileName() + "." + format);
//if (nsFile != null) {
var nsFile = Components.classes["@mozilla.org/file/local;
1"].createInstance(Components.interfaces.nsILocalFile);
nsFile.initWithPath( 'C:\\Documents and Settings\\geo\\Desktop\
\ScreenGrabs\\' + Screengrab.defaultFileName() + "." + format );
var binaryInputStream =
SGNsUtils.dataUrlToBinaryInputStream(dataUrl);
var fileOutputStream = SGNsUtils.newFileOutputStream
(nsFile);
SGNsUtils.writeBinaryInputStreamToFileOutputStream
(binaryInputStream, fileOutputStream);
fileOutputStream.close();
//}
},

gasp...@googlemail.com

unread,
Jan 20, 2009, 12:14:43 PM1/20/09
to screengrab
Check out: http://pearlcrescent.com/products/pagesaver/
Page Saver Basic is Free Firefox Extension (xpi) and it has this
feature and more.


On Dec 29 2008, 2:25 pm, awarner20 <awarne...@yahoo.com> wrote:
Reply all
Reply to author
Forward
0 new messages