我在FilemakerPro中调用了一个Applescript。 这些是我试图实现的目标:
正在激活Applescript以执行这些操作:
我收到的第一个错误是它无法检索图像的尺寸。此外,它不会创建我调整大小的图像......任何想要帮助我的人都在正确的方向吗?
set pad to cell "ServerImagePath" of current record
set filenaam to cell "afbeelding_local_vol_pad" of current record
set foldernaam to cell "calculate_merk_id" of current record
set volle_foldernaam to cell "ServerImageFolder" of current record
set volle_filenaam to cell "ServerImageFile" of current record
set target_small_width to 155
set target_small_height to 134
set target_large_width to 400
set target_large_height to 400
tell application "Finder"
if not exists volle_foldernaam then
make new folder at pad with properties {name: foldernaam}
end if
duplicate filenaam to volle_foldernaam with replacing
tell application "Image Events"
launch
set this_image to filenaam
copy dimensions of this_image to {W, H}
if target_small_width is greater than target_small_height then
if W is greater than H then
set the scale_length to (W * target_small_height) / H
set the scale_length to round scale_length rounding as taught in school
else
set the scale_length to target_small_height
end if
else if target_small_height is greater than target_small_width then
if H is greater than W then
set the scale_length to (H * target_small_with) / W
set the scale length to round scale_length rounding as taught in school
else
set the scale_length to target_small_width
end if
else
set the scale_length to target_small_height
end if
scale this_image to size scale_length
pad this_image to dimensions {target_small_width, target_small_height}
save this_image as this_name & "__small"
close this_image
end tell
end tell
答案 0 :(得分:0)
您忘了打开图片
set this_image to filenaam
应该是
set this_image to open filenaam
答案 1 :(得分:0)
为什么不在FileMaker中本地执行此操作? FM 12及更高版本具有GetThumbnail()函数。脚本可以将重新调整大小的图像计算为全局字段,然后从全局字段中导出图像。完全跨平台将适用于OSX和Windows,甚至是FileMaker Go。
Set Field [ photo_temp_g ; GetThumbnail ( photo_original ; width ; height ) ]
Commit Record/Request []
Export Field Contents [ photo_temp_g ; “<filename>” ]