Applescript Troubles in Xcode 3.0

Discussion in 'Mac Programming' started by Heli0s38, May 4, 2009.

  1. Heli0s38 macrumors newbie

    Joined:
    May 4, 2009
    #1
    Hello,

    i'm having some issues with xcode 3 and AppleScript.


    i'm making a Doc-based Applescript app (a simple web browser for a friend's mac thats pretty old.)

    i added a menu called "Tools" and it was labeled in applescript "mnuTools" and a menu item "Download Manager" labeled in applescript "mnuDownload"

    i havent entered in the code for what it should do when clicked, i just wanted to make sure it worked first, but when i run it i get an error.

    "The specified object is a property, not an element. (-10008)"

    ive tried numerous methods of fixing this. am i missing something? here is the code.

    Code:
    on choose menu item theObject
    	if theObject is menu item "mnuDownload" of menu "mnuTools" then
    		display dialog "its working"
    	end if  
    end choose menu item

    and everything seems to check out in IB.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    This worked for me: in IB with the "Download Manager" menu item selected, go to Tools > AppleScript Inspector and give it a name "mnuDownload". Then change your code to:
    Code:
    on choose menu item theObject
        if name of theObject is "mnuDownload" then
            display dialog "its working"
        end if
    end choose menu item
     
  3. Heli0s38 thread starter macrumors newbie

    Joined:
    May 4, 2009
    #3
    sorry for bumping such an old thread, but i completely forgot to reply saying that worked. thank you so much and im terribly sorry for bumping
     

Share This Page