Colloquy and AppleScript: Context menu for room members?

Discussion in 'Mac Programming' started by Draft, Mar 17, 2010.

  1. Draft macrumors 6502

    Joined:
    Jun 18, 2002
    Location:
    Chicago, IL
    #1
    I am trying to write an AppleScript for Colloquy that presents a new context menu item when right-clicking on a member of a room, then when selecting the menu item does some action using the user name from which the context menu was built and accessed. I've checked the examples on the Colloquy site, but none of them explicitly do what I need to do and I'm not familiar with how AppleScript works in order to get the information out of objects that I need in order to move forward.

    What I currently have is below and includes comments on how I believe this should be accomplished. Any ideas on how to do this? Thanks in advance.

    Code:
    using terms from application "Colloquy"
    	on build contextual menu for item theMenuItem in theView
    		(*wrap return statement with an if statement that determines if this is a member of a room, rather then a window, room, etc.*)
    		return {"Who is this?"}
    	end build contextual menu for item
    
    	on handle clicked contextual menu item theMenuItem for theContextItem
    		if (theMenuItem as string) is equal to "Who is this?" then
    			set theUser to "blah" (*replace with conversion of theContextItem to string with the member name*)
    			tell active panel of front window
    				add event message (theUser as string) with name "member user name"
    			end tell
    		end if
    	end handle clicked contextual menu item
    end using terms from
    
     
  2. Draft thread starter macrumors 6502

    Joined:
    Jun 18, 2002
    Location:
    Chicago, IL

Share This Page