My latest effort is trying to replace this routine, but I've spent hours reading the documentation, and can't work out what to do.
We often get files without extensions, and need to add them. Any advice please
on AttachmentsPrintCycleThree(holding_folder_temp) --Add attachment name extensions
set tt to current date
try
set theTempList to {}
try
set posixPath to POSIX path of ((holding_folder_temp as text) as alias)
set theTempList to my urlsInFolder_(posixPath)
-- set theTempList to (get every file of holding_folder_temp) as alias list # altered
if RunForOz then say (("Attach cycle 3.1 ," & ((current date) - tt)) as text) # 5 seconds, 2 seconds
on error
set theTempList to {}
end try
tell application "Finder"
if the name of holding_folder_temp = "Links" then
set parent_Folder to container of holding_folder_temp
set t to ((every file of parent_Folder whose name extension = "indd") as alias list) # altered
if (count of t) > 0 then set theTempList to {}
end if
end tell
if (count of theTempList) ≠ 0 then
repeat with theFile in theTempList
try
try
set oneFile to theFile's getPathComponent() # Doesn't work.
on error errmsg
display dialog "oneFile 3 " & errmsg
end try
1
tell application "Finder"
set {creator type:CT, name extension:NE, kind:KI, name:NA} to oneFile
if (NE is missing value or NE = "") then
if CT = "InDn" then
try
set name of oneFile to (NA & ".indd")
end try
end if
if CT = "XPR3" then
try
set name of oneFile to (NA & ".qxp")
end try
end if
if KI = "Rich Text Format (RTF)" then
try
set name of oneFile to (NA & ".rtf")
end try
end if
if KI = "RTF with attachments (RTFD)" then
try
set name of oneFile to (NA & ".rtfd")
end try
end if
if KI = "Unix Executable File" then
try
set name of oneFile to (NA & ".eps")
end try
end if
end if
end tell
on error errmsg
display dialog "Att print 3 " & errmsg
end try
end repeat
set OnlyPrintIndandQuarkflag to false
tell application "Finder"
set TempList to (get every file of holding_folder_temp) as alias list # altered
repeat with oneFile in TempList
try
if name extension of oneFile is in {"indd", "inx", "qxp", "qxd"} then
set OnlyPrintIndandQuarkflag to true
exit repeat
end if
end try
end repeat
end tell
end if
on error theerror number errNum
tell application "Finder" to activate
if errNum ≠ -1728 and errNum ≠ -10006 then display dialog " AttachmentsPrintCycleThree " & return & "Error number " & errNum & return & theerror as text giving up after 5
end try
if RunForOz then say (("Attach cycle 3 ," & ((current date) - tt)) as text) # 42 seconds
my AttachmentsPrintCycleFour(holding_folder_temp as alias)
end AttachmentsPrintCycleThree