I wrote about :
(* http://www.macscripter.net/post.php?tid=45852 *)
# Use the AliasPath 1.1 CLI from :http://klieme.com/Downloads/misc/AliasPath1.1.zip, http://www.macscripter.net/viewtopic.php?id=45852&p=2
set brokenAliases to do shell script "/Users/admin/bin/AliasPath -bo"
# Replace the extraneous ending linefeed by the character "¶"
set brokenAliases to my remplace(brokenAliases, return & tab, "¶" & tab)
set fileDescriptor to open for access ((path to desktop as text) & "FinderBrokenAliases.txt") with write permission
# Write starting from 0 (delete possible old content)
set eof of fileDescriptor to 0 # ADDED
write brokenAliases to fileDescriptor
close access fileDescriptor
#=====
(*
replaces every occurences of d1 by d2 in the text t
*)
on remplace(t, d1, d2)
local oTIDs, l
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d1}
set l to text items of t
set AppleScript's text item delimiters to d2
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end remplace
If I disable the instruction : set brokenAliases to my remplace(brokenAliases, return & tab, “¶” & tab) I get the first group of datas posted in my late message.
If I enable it, I get the second group of datas.
Guess why there are some ¶ characters in the second group.
Your CLI doesn’t explicitly create such datas.
It’s just that when it get the path
"/Volumes/Macintosh HD/Users/???/Library/Speech/Speakable Items/Application Speakable Items/Pages/Target Application Alias
" (Yes, with a return character at end),
it add a tab and “/Applications/Utilities/AppleScript Editor.app”
I don’t understand why you are surprised. You edited the code of the CLI to achieve that, no less, no more.
If I run the beginning of the “old” script :
set allAliasFiles to (do shell script "mdfind \"kMDItemKind == 'Alias'\"" without altering line endings)
set {TID, text item delimiters} to {text item delimiters, linefeed}
set allAliasFiles to text items of allAliasFiles
set text item delimiters to TID
allAliasFiles
I get :
{"/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/System Preferences/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/VLC/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/Xcode/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/iTunes/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/HexEdit/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/Finder/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/ImageWell/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/JavaApplicationStub/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/Mail/Target Application Alias
", "/Users/??????????/Library/Speech/Speakable Items/Application Speakable Items/Safari/Target Application Alias
", "/Library/Fonts/Monospaced ƒ/Andale Mono.ttf", …
Which show the aliases safe ones as well as broken ones with their ending return.
I rebuilt the script using your first version of the CLI :
set allAliasFiles to (do shell script "mdfind \"kMDItemKind == 'Alias'\"" without altering line endings)
set {TID, text item delimiters} to {text item delimiters, return}
set allAliasFiles to text items of allAliasFiles
set text item delimiters to TID
repeat with i from 1 to count allAliasFiles
set item i of allAliasFiles to quoted form of item i of allAliasFiles
end repeat
tell AppleScript
set oldTIDs to text item delimiters
set text item delimiters to space
set bashList to allAliasFiles as string
set text item delimiters to oldTIDs
end tell
tell application "System Events"
set maybe to exists file "/Users/admin/bin/AliasPath0"
log maybe
end tell
set brokenAliases to do shell script "/Users/admin/bin/AliasPath0 -b " & bashList
set fileDescriptor to open for access ((path to desktop as text) & "FinderBrokenAliasesCli0.txt") with write permission
set eof of fileDescriptor to 0
write brokenAliases to fileDescriptor
close access fileDescriptor
As you see, the original version of the CLI is named AliasPath0 here so that I may have two versions available for tests.
Alas, this version returns an empty text file.
Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) vendredi 28 juillet 2017 12:11:17