Re: FM insert Picture
Re: FM insert Picture
- Subject: Re: FM insert Picture
- From: John Haley <email@hidden>
- Date: Mon, 16 Jul 2001 15:46:24 -0500
Just in case there are still any problems, I thought I would send out the
sample script that comes with FileMaker 5.5 in the AppleEvent folder's
Example app folder:
--choose a folder with picture files
activate
set folderPath to (choose folder with prompt "Choose a folder with pictures
to import
")
--create a list of all files in the folder
set fileList to list folder folderPath
--initialize pictureCount variable
set pictureCount to 0
--create a new record for each picture
repeat with pictureFileName in fileList
tell me to set pictureFileRef to (folderPath & pictureFileName as
string)
if folder of (info for (alias pictureFileRef)) = false then
if file type of (info for (alias pictureFileRef)) = "PICT" then
tell application "FileMaker Pro"
activate
tell database "Picture Database"
set newRecord to create record
go to newRecord
set cell "Name" of newRecord to pictureFileName
set cell "Picture" of newRecord to file (pictureFileRef)
set pictureCount to pictureCount + 1
end tell
end tell
end if
end if
end repeat
--display number of pictures found
tell me to activate
if pictureCount = 0 then
display dialog "No files of type PICT were found in folder " &
folderPath
else
display dialog "Number of pictures imported using file reference: " &
pictureCount
end if
Of course the sample database can be found in the sample folder with the
script if you need it.
>
From: "Goodman, Steve" <email@hidden>
>
Date: Mon, 16 Jul 2001 14:03:24 -0500
>
To: email@hidden
>
Subject: RE: FM insert Picture
>
>
I'm definitely not the FM Pro authority but don't you have to direct it to
>
the record that you want to update? Or is it because I have an "ancient"
>
version of the software?
>
>
>
set x to choose folder
>
set filelist to list folder x without invisibles
>
repeat with i from 1 to count of filelist
>
tell window 1 of application "FileMaker Pro"
>
activate -- so you can watch
>
set newrecord to create new record
>
set cell "ImageName" of newrecord to item i of filelist as text
>
set cell "Imagepath" of newrecord to (x & item i of filelist) as
>
string
>
set cell "Image" of newrecord to file ((x & item i of filelist) as
>
string)
>
end tell
>
end repeat
>
>
>
Steve Goodman
>
Vertis Advertising Production Services
>
phone 314.432.8800, ext. 479
>
fax 314.692.0309
>
email@hidden
>
www.vertisinc.com
>
>
> ----------
>
> From: Jean-Marie Hoornaert
>
> Sent: Sunday, July 15, 2001 3:55 PM
>
> To: email@hidden
>
> Subject: Re: FM insert Picture
>
>
>
> le 15/07/01 22:05, Max Bonilla a icrit :
>
>
>
>> I sent this already, but I believe I might have had a problem with my
>
>> server and did not receive any messages for a few days. Perhaps
>
>> someone had responded and I was not able to read the message. So
>
>> here it goes again. Sorry for the double post and thanks for the
>
>> help.
>
>>
>
>>
>
>> I'm trying to insert a picture to a FM database but no matter how I
>
>> try I get an error.
>
>>
>
>> tell application "FileMaker Pro"
>
>> set LifeTeenPictures to alias "MacintoshHD:Dumping
>
>> Ground:Kodak Darkroom:LifeTeen Pictures:"
>
>> set PhotoName to "0687.JPG"
>
>> set PhotoStorage to LifeTeenPictures & PhotoName as string
>
>> set PhotoStorage to a reference to file PhotoStorage
>
>>
>
>>
>
>> set cell "Picture" to PhotoStorage
>
>> set PhotoStorage to cell "Picture"
>
>> end tell
>
>>
>
>>
>
>> The name of the picture will change as the script runs, so I need to
>
>> find a way to make PhotoStorage a file reference that FM will
>
>> appreciate. Any help will be much appreciated. Thanks a million!
>
>
>
> Try this :
>
>
>
> set LifeTeenPictures to ,
>
> "MacintoshHD:Dumping Ground:Kodak Darkroom:LifeTeen Pictures:"
>
> set PhotoName to "0687.JPG"
>
> set PhotoStorage to LifeTeenPictures & PhotoName as string
>
>
>
> tell application "FileMaker Pro"
>
> set cell "Picture" to file PhotoStorage
>
> end tell
>
>
>
> And take a look at :
>
> http://users.skynet.be/jmh-h2o/Telechargements/Informations/catalogueur.ht
>
> ml
>
> there, clic on "Telechargement 84Ko"
>
>
>
> It's in french, but it is a "FMPro-AppleScript" picture catalogue.
>
>
>
>
>
> --
>
> Jean-Marie -HOO;-)
>
> ____________________
>
> Jean-Marie Hoornaert
>
> email@hidden
>
> http://www.h2o.be
>
> AppleScripting FileMaker
>
> French web site
>
> _______________________________________________
>
> applescript-users mailing list
>
> email@hidden
>
> http://www.lists.apple.com/mailman/listinfo/applescript-users
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users