I’m trying to build a simple script that will quit the application Image Capture. When I hook up my digital camera to my computer, Image Capture launches, then downloads pictures from my digital camera. You can then have Image Capture perform an action, so I want a script that makes the app quit so I don’t have to do it manually.
The script that I have looks like this:
tell application "Image Capture"
quit
end tell
When I play the script from Script Editor, it closes the app just fine. But when I save it and run the file, or (more importantly) when Image Capture runs the file automatically, it closes Image Capture but then returns the error message “connection is invalid.”
When I connect my camera, Image Capture downloads the files, then runs my script like it’s supposed to… but then the script quits right after it opens and Image Capture remains open.
Funny thing is, if I connect the camera when no pics are on it, the script fully runs and quits Image Capture. The only time it won’t fully run the script is if there are pics on the camera.
I thought maybe Image Capture needed more time to download the files, so I put a delay command in the script, but that didn’t help. The script just closes immediately after it opens, rather than running fully.