Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fixing an Applescript for Importing

Status
Not open for further replies.

Sporky

Technical User
Jul 23, 2003
1
US
Recently the company I work for decided to change our FileMaker system to make it cross-platform compatible, which it currently isn't. So now I'm in the process of renaming our images with extensions and reimporting them back into the system so the images are viewable on PCs as well as Macs. My problem is that we imported the images before, obviously, without extensions, however we also did this by applescript. I was wondering if it is possible to fix the following applescript so it will know to look for not just the "Code" field but it will look for an added ".pct" on the end of the name.

Any help would be greatly appreciated!

---- Start Script


--choose a folder with picture files
activate
set folderPath to (choose folder with prompt "Choose a folder with picture 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 application "FileMaker Pro"
activate
tell database "Artists"
set pictureFileName to cell "Code" of current record
end tell
end tell

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 "Artists"
set cell "Image" of current record to file (pictureFileRef)
go to record after current record
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 Image Available in Current Folder" & folderPath
else
display dialog "Number of pictures imported using file reference: " & pictureCount
end if


---- End Script
 
see thread295-613559 along with
use of File-->Import Records--> Folder...
no need for scripting

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top