Hi,
I would like to add the ability to write key word tags to files in Mac OS X. I have found details in the LC dictionary of how to access the resource fork (OS9?) but not how to write to the extended attributes of Mac OSX files.
Googling suggests I need to use the OS command "xattr" and process some hex all via a shell command. However, I thought I'd ask if there is another way before I leap into the unknown.
So any thoughts?
Simon
How do you write file tags to OSX files?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
How do you write file tags to OSX files?
best wishes
Skids
Skids
Re: How do you write file tags to OSX files?
Hi Simon,Simon Knight wrote: I would like to add the ability to write key word tags to files in Mac OS X.
However, I thought I'd ask if there is another way before I leap into the unknown.
not a direct answer but might give you some insights....
Code: Select all
on mouseUp
// 2 parameters: a filename and a color
constant myFile = "~/Desktop/testMe.txt"
put "orange" into aColor
// build a color array
local Tcolor
get TableColor( "clear", 01, "gray", 03, "green", 04, "purple", 06, "blue", 09, "yellow", "0A", "red" , "0C" ,"orange", "0E" )
put IT into Tcolor
// from a valid color name get its value
put Tcolor[ aColor] into aColor
// set the xattr command
get "xattr -wx com.apple.FinderInfo 000000000000000000%2s00000000000000000000000000000000000000000000 %s"
// execute it
if shell( format( IT, aColor, myFile)) is not empty then
beep
put "ERROR SHELL ! " & syserror()
end if
end mouseUp
private function TableColor
local newTable
repeat with i= 1 to (the paramcount -1) step 2
put param( i+1) into newTable[ param( i) ]
end repeat
return newTable
end TableColor
This snippet of code will change the color Tags of a file
using the xattr terminal command.
Regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: How do you write file tags to OSX files?
Thanks Thierry,
This is just the help I needed, I'll post again when I have completed some experiments.
Thanks
This is just the help I needed, I'll post again when I have completed some experiments.
Thanks
best wishes
Skids
Skids