Jump to content
Sign in to follow this  
lonesomejubilee

isight import?

Recommended Posts

Hi,

I see there is a built in script to import pics from a camera, does anyone have a script to take a picture from the iSight and auto import it into a container?

Sort of like how iAlert U works for iSight?

Thanks... cause it would be cool!

Share this post


Link to post
Share on other sites

There is a small command line app that can take a picture and write it to a file. It could be run in an AppleScript, in a Perform AppleScript step from FileMaker. You would just need to convert the path to FileMaker syntax, use the Set Variable step, then Insert it into a container field.

http://www.versiontracker.com/dyn/moreinfo/macosx/27190

The AppleScript code is fairly simple. You need to include the full path to wherever you put the app.

do shell script "'/Applications/Utilities/zUtilities/iSight Capture/isightcapture' ~/Desktop/image.jpg"

-- default 640x480 jpeg


There are other sizes and graphic types available also.





For a real strange experience, create a Web Viewer object, then set its URL to:




http://www.clarify.net/peter/spy/test.html

This will show a live picture from your isight camera. You can watch yourself watch yourself ;)-]

Edited by Guest

Share this post


Link to post
Share on other sites

I am working on a variant of this solution provided by Fenton. I am having trouble bringing the picture data in permanently to Filemaker.

I get the following error: "Filemaker Pro got an error: Data is being accessed by another user, script, or transaction."

Is there a better applescript command that will actually paste the picture data into the container vs. simply displaying the file contents as it seems it is currently doing?

I have included my sample file, with scripts. The purpose of this is to have multiple, related (child) pictures, for one (parent) record. I could be doing this backwards.. any help would be appreciated.

isight_project.zip

Share this post


Link to post
Share on other sites

When you see things like:


do shell script "/Users/path/to/isightcapture /Users/path/to/image.jpg"

it means just what it says, type the path to the application, and type or calculate the path to the image on your computer.

I don't know where you got that example, likely from isightcapture's documentation. But you cannot just copy/paste stuff like that and expect it to work. It is just a way for the developer to tell you where to put your own REAL paths there instead. He has no idea where you want to put things.

My example in the previous post uses the Unix shorthand for the user's desktop for the image path, which is the same for everyone. But you still need the actual path to the iSightCapture application; which could be ANYWHERE on your computer. We don't know where you put it. I put mine in a subfolder of the Utilities folder.*

'/Applications/Utilities/zUtilities/iSight/iSight Capture/isightcapture'

Remember to enclose the file path with single quote marks if it has spaces. Unix requires spaces in file paths to be escaped.

*I suppose one could just put a copy of the application in with the file, and calculate the relative path to it. But this would not work in a networked situation, as the clients don't have the FileMaker files on their machine. They would each need a copy of the isightcapture app, in the same place, like Utilities.

I suppose one could put isightcapture in a container field, then export it to their Utilities folder, or to their Application Support folder (where you could be sure they have permissions). It's only 44K.

(P.S. AppleScript can find their Application Support folder, via:

path to application support from user domain

but that's a Mac alias path, not a FileMaker syntax path. You'd need to convert before exporting from FileMaker.

In other words, that whole process is more complex than just typing the paths correctly.)

Edited by Guest

Share this post


Link to post
Share on other sites

Umm, that's my fault, I put that path example in my script. I was simply trying to put a sample path example into my script example as I *expected* it would necessarily have to be changed on another user's machine. My fault for assuming...

I can get get an image into a container field, that's not the problem, the isight app works great. My problem is that the file needs to be stored (the terminal command saves Jpeg image as the same name every time a new picture is taken, to the same file location) uniquely, as I want to associate multiple pictures with one record.

Share this post


Link to post
Share on other sites

Oh, I see. You put in generic paths so as not to confuse us. And I answered that instead.

What you could do is to rename the picture, using a timestamp, either beforehand or afterward. Each of which presents its own problems. Here's a simple shell script to get a timestamp:


set TS to do shell script "date +%y%m%d%H%M%S"

-- "080223152745"

Alternatively you could get the current Timestamp from FileMaker, and pass it to the AppleScript.

But I have to wonder why you're saving the pictures as files. If you're going to embed them in the FileMaker file, then you could just overwrite the file each time. To embed the picture you would call a FileMaker script to do that using the Insert Picture step. You can call an FileMaker script from AppleScript using the syntax:

do script FileMaker script "script name"

(Put the name of the script, don't change the name later. Don't tell the current record to do this, it's more an application database command.)

If you're not going to embed the pictures, then yes, you'd need to either rename or move the file. But then there'd be considerations if you were on a network. Are you?

Edited by Guest

Share this post


Link to post
Share on other sites

Ah, I seem to be making a mess of this.. Yes, you are correct in your questioning of why I wouldn't I want to embed the picture into Filemaker.. I couldn't figure out how to get the .jpeg file into the container field via the Applescript "set " command...The work flow is this, or this is what I am trying to do... For each employee record, I want to associate three separate images. I would like the user to be able to click a scripted button to "take" picture one, then two, then three. Ideally, I'd like the child picture records to be related to the Parent Employee record by the employee ID. My thought was, that when the user is in the Parent record, the script could first copy the employee record ID, go to the related picture table, create a new record, paste the employee ID, then run the isight script, insert the JPEG image into a container in the child table. Hopefully the pictures would show up in a portal in the Parent Table as related records...

Share this post


Link to post
Share on other sites

Yes, I would say that you DO want to embed them. It's just simpler on hosted files with these smallish pictures. What size do you think, for a full-sized image. The default of isightcapture is width 640x480 height.

That also makes it simpler, because then you can overwrite the file, after embedding.

Edited by Guest

Share this post


Link to post
Share on other sites

Are you willing/able to manually put the isightcapture app into their Utilities folder?

Share this post


Link to post
Share on other sites

Yes, I absolutely can place the iSightcapture App in the Utilities folder. Each "client" or user, is updating a shared database served by FM Server 8.

Edited by Guest

Share this post


Link to post
Share on other sites

Phil Goodman had a shell script for this...

Phil Goodman, Goodman Consulting, Los Angeles

http://www.goodmanconsulting.com

Share this post


Link to post
Share on other sites

OK, this will do it, from the Employees layout. I made the portal's relationship [x] Allow creation, so you don't even have to go to another layout.

The path to the app needs to be:

/Applications/Utilities/iSightCapture/isightcapture

Ignore any spaces in the name. The forum parser likes to add them.

Folder is iSightCapture. I believe the name is case-sensitive (Unix).

I cut the Pause down to 2 seconds. On my computer 1 second seems enough.

(I look pretty awful. It's the lighting :-)

isightcapture.fp7.zip

Edited by Guest

Share this post


Link to post
Share on other sites

Outstanding, thanks for your help in extending this concept! It works well! It's too bad there isn't a more robust set of drivers for ImageCapture, as that would be a cleaner solution...

Much appreciated!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.