with the help of Jean-Baptiste LE STANG
i have got this much to work except for
set name of this_item to shortName & “H.tif”
why won’t it change the file name?
maybe i have benn goin about it all wrong
I am trying to run a script that does some stuff in Photoshop and saves these images in 3 location but in one of thew locations i need the file to end with H.tif instead of W.tif this is where the attached script would come in
sounds simple but it has kept me up at night thinking of how do make it happen
tell application "Finder"
set cf to folder "Macintosh HD1:Users:jbradfield:Desktop:Move to Graphics:" --as alias
set {nameList, dateList} to {name, modification date} of every file of cf
set myOffset to my getOldestFile(dateList)
set this_item to item myOffset of nameList
set this_item to ((cf as string) & this_item) --as alias
set this_info to info for file this_item
set the current_name to the name of this_info
set character_count to the number of characters in current_name
set shortName to characters 1 thru (character_count - 5) of current_name as string
if current_name ends with "W.tif" then
set name of this_item to shortName & "H.tif"
end if
display dialog this_item
end tell
on getOldestFile(dateList)
set oldestDate to item 1 of dateList
set offsetoldestDate to 1
repeat with x from 1 to count dateList
if (item x of dateList) > oldestDate then set {oldestDate, offsetoldestDate} to {(item x of dateList), x}
end repeat
return offsetoldestDate
end getOldestFile
again thanks to all who help us so much