This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
action:Get_File_Attribute [2019/03/21 15:13] JMichaelTX ADD section on Alias and SymLink |
action:Get_File_Attribute [2019/03/21 19:15] JMichaelTX Revise script to distinguish between Alias and SymLink |
||
---|---|---|---|
Line 15: | Line 15: | ||
{{:action:get-file-attribute-km8.png?nolink|}} | {{:action:get-file-attribute-km8.png?nolink|}} | ||
- | If you want to determine if the Finder Item is an Alias or SymLink, you can use this AppleScript, which will return "Alias" if the Item is either an Alias or SymLink. | + | If you want to determine if the Finder Item is an Alias or SymLink, you can use this AppleScript, which will return either "Link: Alias" OR "Link: SymLink" OR the file kind. |
```applescript | ```applescript | ||
Line 22: | Line 22: | ||
set theItem to item 1 of theSel | set theItem to item 1 of theSel | ||
set itemKindStr to (kind of theItem) as text | set itemKindStr to (kind of theItem) as text | ||
+ | | ||
+ | if (itemKindStr ≠ "folder") then | ||
+ | set itemFileType to (file type of theItem) as text | ||
+ | else | ||
+ | set itemFileType to "folder" | ||
+ | end if | ||
+ | | ||
+ | if (itemKindStr = "Alias") then | ||
+ | if (itemFileType = "missing value") then | ||
+ | set itemKindStr to "Link: SymLink" | ||
+ | else | ||
+ | set itemKindStr to "Link: Alias" | ||
+ | end if | ||
+ | end if | ||
+ | | ||
end tell | end tell | ||
return itemKindStr | return itemKindStr | ||
- | -->Alias | + | -->Link: Alias |
+ | -->Link: SymLink | ||
+ | -->BBEdit text document | ||
``` | ``` | ||
+ | |||