Honestly, it's not. Using variable names like t and tAll doesn't help. What's x about? Your onlyPrintIndandQuarkflag appears to end up with the value set by the last file, which would appear to make it useless. There's just too much noise that helps make it unreadable.
on getItemsInPOSIXPath:posixPathOfHoldingFolder
set fileManager to current application's NSFileManager's defaultManager()
set holdingFolderURL to current application's class "NSURL"'s fileURLWithPath:(posixPathOfHoldingFolder)
set {theURLs, theErrors} to fileManager's contentsOfDirectoryAtURL:holdingFolderURL includingPropertiesForKeys:{} options:(current application's NSDirectoryEnumerationSkipsHiddenFiles) |error|:(reference)
return {theURLs, theErrors} -- theURLs will be missing value if there's an error
end getItemsInPOSIXPath:
on checkURLCanBeProcessed:oneURL
set theExt to oneURLString's pathExtension() as text
if theExt is not "" then
if theExt is in {"indd", "inx", "qxp", "qxd"} then
return {canProcess:true, isQuarkOrInd:true}
else
return {canProcess:true, isQuarkOrInd:false}
end if
end if
set {theFlag, theValue} to (oneURL's getResourceValue:(reference) forKey:(current application's NSURLLocalizedTypeDescriptionKey) |error|:(missing value)) -- get description
if (theFlag as boolean) is false then return {canProcess:false, isQuarkOrInd:false} -- something went wrong getting the resource value
set theValue to theValue as text
set fileManager to current application's NSFileManager's defaultManager()
if theValue = "Rich Text Format (RTF)" then
tell fileManager to moveItemAtURL:(oneURL) toURL:(oneURL's URLByAppendingPathExtension:"rtf") |error|:(missing value)
return {canProcess:true, isQuarkOrInd:false}
else if theValue = "RTF with attachments (RTFD)" then
tell fileManager to moveItemAtURL:oneURL toURL:(oneURL's URLByAppendingPathExtension:"rtfd") |error|:(missing value)
return {canProcess:true, isQuarkOrInd:false}
else if theValue = "Unix Executable File" then
tell fileManager to moveItemAtURL:oneURL toURL:(oneURL's URLByAppendingPathExtension:"eps") |error|:(missing value)
return {canProcess:true, isQuarkOrInd:false}
else -- fall back to creator type
set attRecord to (fileManager's attributesOfItemAtPath:(oneURL's |path|()) |error|:(missing value)) as record -- returns a whole lot of stuff
set creatorType to NSFileHFSCreatorCode of attRecord
if creatorType = 1.231963246E+9 then -- InDn as an integer
tell fileManager to moveItemAtURL:(oneURL) toURL:(oneURL's URLByAppendingPathExtension:"indd") |error|:(missing value)
return {canProcess:true, isQuarkOrInd:true}
else if creatorType = 1.481658931E+9 then -- XPR3 as an integer
tell fileManager to moveItemAtURL:(oneURL) toURL:(oneURL's URLByAppendingPathExtension:"qxp") |error|:(missing value)
return {canProcess:true, isQuarkOrInd:true}
else -- got nowhere
return {canProcess:false, isQuarkOrInd:false}
end if
end if
end checkURLCanBeProcessed:
Now redo you handler to use them. But don't just try to copy and paste -- rewrite the handler completely, trying to make it simpler and easy to follow.