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
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