Re: Hotkeys to Snapz Pro or Grab
Re: Hotkeys to Snapz Pro or Grab
- Subject: Re: Hotkeys to Snapz Pro or Grab
- From: Matthew <email@hidden>
- Date: Fri, 11 Feb 2005 08:37:27 -0500
Thanks to you all who have replied. I'd seen the "weak" dictionary
offered by Snapz for the screen capture and a similar script for screen
captures through "screencapture".
The crux of what I was trying to do, however, was stop recording video
with Snapz, and the dictionary doesn't allow you to do this with
applescript. The only way I can stop the video is by sitting here on my
computer and manually pressing Cmd-Shift-3 (or whatever you customize).
Given that I have no programatic way of stopping video directly with
Snapz, I was hoping to be able to send those keystrokes via AppleScript
without to circumvent having to actually sit here and do it myself. To
put it another way, I was hoping to simulate the keystrokes with an
AppleScript, and the obvious approach I took wasn't working.
I mentioned the thing with Grab, because everyone should have Grab, be
able to press Cmd-Shift-4 and see the cursor turn into a cross-hare,
even though everyone might not have a copy of Snapz. Analogously, if I
could do what I want to do with Snapz, I could do it with Grab as well.
Ever seen those programs that allows you to define hotkeys and things
like that so that when you press "F6" (or whatever) a little macro runs
that does a series of keystrokes for you to make life easier?
Basically, that's another way of putting this, only I just want to do
with with a one-time AppleScript
On Feb 11, 2005, at 4:09 AM, Barry Wainwright wrote:
This will get a screen grab without using either Snapz Pro or Grab:
set tempDirectory to POSIX path of (path to temporary items from user
domain)
set inputFile to tempDirectory & "screencapture.pdf"
do shell script "screencapture -i " & inputFile
If required, the PDF file can be converted to a png file with this
script:
set outputFile to tempDirectory & "screencapture.png"
tell application "Image Events"
set theImage to open file (inputFile as string)
save theImage as PNG in file outputFile without icon
close theImage
end tell
Other options for screencapture are:
usage: screencapture [-icmwsWx] [file]
-i capture screen interactively, by selection or window
control key - causes screen shot to go to clipboard
space key - toggle between mouse selection and
window selection modes
escape key - cancels interactive screen shot
-c force screen capture to go to the clipboard
-m only capture the main monitor, undefined if -i is set
-w only allow window selection mode
-s only allow mouse selection mode
-W start interaction in window selection mode
-x do not play sounds
-S in window capture mode, capture the screen not the window
file where to save the screen capture
Obviously, this doesn't do video capture.
Snapz Pro is scriptable - up to a point. It has 2 commands: 'invoke' to
bring the capture palette up, and 'capture' to grab an image of the
screen.
Grab doesn't appear to have any dictionary at all.
--
Barry
From: Matthew <email@hidden>
Date: Fri, 11 Feb 2005 00:32:03 -0500
To: <email@hidden>
Subject: Hotkeys to Snapz Pro or Grab
Hello,
I'd like to be able to send hotkey combinations like Cmd-Shift-3, or
any other combination for that matter to Snapz Pro X to stop video
recording or use a similar key combination to invoke screen capture,
open Grab, etc. I'm not so much interested in working around this
(unless it's by programatically sending keystrokes) as I am actually
using AppleScript to do it for me.
Here's what I've tried, and I'm running Panther.
tell application "System Events"
keystroke "3" using {shift down, command down}
end tell
Ok, so that obviously didn't work, although intuitively I thought it
would. I also tried a variation where I nested a "tell process "Snapz
Pro X" inside the "tell application" but that didn't work either, and
I
really didn't expect it to.
Is the problem that I'm not supposed to be sending this to "System
Events" or that AppleScript just can't do this? I read in the Snapz
Pro
docs that they registered their hotkeys to be intercepted and
processed
down on the Carbon level, but I'm not sure if that's relevant?
If you don't have Snapz Pro X, could someone comment on how to get
something like Grab to invoke via using a hotkey combination
Cmd-Shift-4 by applescript sending they keystrokes (or any other
programatically way of doing it)?
If this isn't possible, has anyone else had to work around it before?
I've been looking in CarbonEvents.h a bit.
Matthew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list
(email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden