(cross-posted to both the Quicktime VR and applescript-users lists.)
Hello all and I apologize in advance for the long post. I have a
tricky question for you.
I am trying to automate my use of Nikon Capture using Applescript so
that I can have it trigger the shutter on a Nikon D70 DSLR. Nikon
Capture Editor lists commands in its Applescript dictionary, including:
Nikon Capture Suite: Handles events specific to Nikon Capture
createthumbnail: Adds the file to the thumb directory.
createthumbnail reference
from file specification
takeafpicture: Take a picture with autofocus
takeafpicture
takepicture: Takes a picture without autofocus
takepicture
When I try to use one of these in an applescript as:
tell application "Nikon Capture Editor"
takepicture
end tell
The application opens, but I get an Applescript Error
"Nikon Capture Editor got an error: Can't continue takepicture." and it
doesn't take a picture. You might would think I should be using Nikon
Capture Control (which gets installed along with NCE, and which has a
button to take an autofocus or just take a picture), but these commands
are listed in the dictionary for the Editor and not Control. If I make
the applescript calling the NC Control, it just says the command is
unknown. Editor seems to know the command, but perhaps it has some sort
of input needed that is not apparent from the dictionary (what to take
the picture with or where to put it, etc.)
As an alternative, I tried to script an image capture by using the
"assistive devices" workaround for scripting "unscriptable"
applications - using the application UI Browser to generate a script
that would just click the appropriate button in Nikon Capture Control
to take a picture. I thought I had it figured out, but then things got
weird! It came up with this script:
activate application "Nikon Capture Control"
tell application "System Events"
if (system attribute "sysv") ≥ 4144 then -- Mac OS X 10.3.0
if UI elements enabled then
tell application process "Nikon Capture Control"
-- GUI Scripting statements:
click button "Shoot" of window "Nikon Capture Camera Control"
end tell
else
beep
display dialog "GUI Scripting is not enabled" & return & return &
"Open System Preferences and check \"Enable access for assistive
devices\" in the Universal Access preference pane, then run this script
again." with icon stop
if button returned of result is "OK" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
end if
end if
else
beep
display dialog "This computer can't run this script" & return &
return & "The script uses Apple's GUI Scripting technology, which
requires an upgrade to Mac OS X 10.3 \"Panther\" or newer." with icon
caution buttons {"Quit"} default button "Quit"
end if
end tell
The reason that I say weird is that, when I run the script, I can see
Capture Control activate and the right button appears to be pressed (it
turns blue for a moment), but nothing happens! It works fine if I
click on it directly. I also notice that when it is clicked by the
script, it is blue for a much shorter time than when I click on it
directly with the mouse.
A THIRD approach I am trying is this: the whole reason for doing this
is to use the camera in an automated setup with the eMCee software that
comes from Kaidan to use with it servo controlled turntable for
capturing pictures for QuickTime VR object movies. eMCee is supposed
to be able to control the shutter mechanism directly, but it is sort of
old and worked with Nikon Capture 2 (NC 4 is the present version.) The
way it works is by sending out an apple event with Application
Signature: NAra and
Event Id: NkTp. The application signature is correct, since it
activiates Nikon Capture Editor, but it doesn't make it take a picture.
I was thinking that perhaps the Apple Event ID had changed was why it
wasn't working.
So... to sum up a long posting, I hope someone can help me in one of
three ways:
1) Either you already are scripting Nikon Capture Editor and can tell
me why the takepicture or takeafpicture commands are not working for me
in my applescript OR you are a scripting guru who is willing to
download Nikon Capture (30 day trial) and take a look to see what it is
being so fussy about. The dictionary doesn't seem to indicate that
there should be any arguments for the commands, but perhaps there
should be?
2) Perhaps someone has a clue as to why the second approach I tried of
scripting the UI to click the button only LOOKS like it is clicking the
button without it really clicking and taking a picture.
3) Could anyone tell me how to find the Apple Event ID that is being
sent when I click on the button to take a picture? That would be a
great solution! I haven't a clue how to do that.
Sorry for such a long posting, but I wanted to fully describe the
problem. I feel like I am very close to a solution, but my head is
getting sore from pounding it on the wall for too long with this
problem! Nikon has been pretty useless with questions on this. They
duck under the "that is using third-party software" excuse, even though
they HAD to write the applescript dictionary for the application.
Thanks,
John
(cross-posted to both the Quicktime VR and applescript-users lists.)
John C. Riley, Ph.D.
Assoc. Prof. of Physics
Univ. of SC Upstate
email@hidden
email@hidden
864-503-5775 (w)
864-461-3504 (h)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-VR mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: