Le 2 mars 06, à 14:57, Lennox Jacob a écrit :

Hello,
Is it possible to label (Color Label) a document 'programatically' when it is being Saved in Mac OS 10.4 ? If so, kindly advise. I know how to do it after it is saved ... Under Finder/Preferences... a window appears, and if Labels is chosen a new Tab appears with various colors.
Thanks.
Lennox.

This is based on the AppleScript "set label index of TheFile to LabelIndex". You have to know the label index (0 to 7) which correspond to the colour you want (label index is an integer property). I didn't tested it under MacOS 104 since my current version is 10.3.9, but it should work. It uses the "Finder" to operate.

Sub SetLabelIndex(ForItem As FolderItem,LabelIndex As Integer)
  dim ae As AppleEvent
  dim f As FolderItem
  dim file As AppleEventObjectSpecifier
  dim myPath as string
  dim o As AppleEventObjectSpecifier

  if ForItem=nil then return
  ae=NewAppleEvent("core","setd","MACS") //The "Set" apple event
  myPath = ForItem.AbsolutePath
file = GetNamedObjectDescriptor("alis",nil,myPath) //"Converts" a file to an AppleEvent object ae.ObjectSpecifierParam("----")=GetPropertyObjectDescriptor(file,"labi") //This references the label index property of the "file" object.
  ae.IntegerParam("data") = 4 //The label index
  if not ae.Send then
  end if
End Sub

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to