Re: I've changed the name of a file (etc.) - IT WORKS!
Re: I've changed the name of a file (etc.) - IT WORKS!
- Subject: Re: I've changed the name of a file (etc.) - IT WORKS!
- From: Len Senater <email@hidden>
- Date: Sat, 4 Nov 2000 18:29:49 -0500
>
file variable as file specification
this was the missing link! - simple (especially compared to text
delimiter madness), but I darn near broke my brain trying to figure it
out myself.
Thanks to everyone for their help.
Len
---------------
Here is the final script I ended up using:
-- a script to rename images referenced in a FileMaker db
-- with the product number +.jpg extension
-- super useful for getting images organized for the web
tell application "FileMaker Pro"
-- note: cell references # will depend on your FileMaker layout
set vPathName to cellValue of cell 2
-- field contains a reference to an image file
-- e.g. file "Work:DMS Group:Database:Test Images:OriginalFileName"
set vProdNumber to cellValue of cell 1
-- field contains the product number
-- e.g. "PN 1234-56a"
end tell
tell application "Finder"
set vPathAlias to vPathName as alias
-- vPathAlias = alias "Work:DMS Group:Database:Test
Images:OriginalFileName"
set vNewName to vProdNumber & ".jpg"
-- vNewName = "PN 1234-56a.jpg"
set the name of vPathAlias to vNewName
-- vPathAlias = alias "Work:DMS Group:Database:Test Images:PN
1234-56a.jpg"
set vNewPath to file vPathAlias as file specification
-- vNewPath = file "Work:DMS Group:Database:Test Images:PN 1234-56a.jpg"
end tell
tell application "FileMaker Pro"
set the cellValue of cell 2 to vNewPath
-- value of cell 2 = file "Work:DMS Group:Database:Test Images:PN
1234-56a.jpg"
-- FileMaker now references the newly renamed file
end tell