Le 23 févr. 06, à 16:10, Jeff O'Brien a écrit :

Hi all,
I was wondering if somebody could help me out with this problem.

I need to set the label of a folder and would like to do it in code by
passing the method a folderitem and an integer. I'd rather not use an
applescript for this.

I am still running under RB 5.5.5

The applescript that works looks like this..

tell application "Finder"
    set label index of folder "zzzzz" of disk "CustomerJobs" to 2
end tell

Ok, I finally found how to achieve this:

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