How can i make applescript run on a button

Discussion in 'Mac Programming' started by Intelligent, Mar 10, 2014.

  1. Intelligent macrumors 6502a

    Intelligent

    Joined:
    Aug 7, 2013
    #1
    hey guys I've been sitting here for 6678 hours trying to make my app, how do i make an action that allows me to press a button so it performs an applescript,
    on myButtonHandler_(sender)
    doesn't work and I've tried ALL combinations.
     
  2. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
    More information would be helpful - that looks like it might be an AppleScriptObJC action handler, so if it is connected to a button, the statements in the handler will be run when the button is pressed.
     
  3. Intelligent, Mar 10, 2014
    Last edited: Mar 10, 2014

    Intelligent thread starter macrumors 6502a

    Intelligent

    Joined:
    Aug 7, 2013
    #3
    Sorry :( but could you try to explain it a bit better, english is not my main language its a applescript cocoa. The problem is i can't connect it to the button.

    on myButtonHandler_(sender)
    my script
    end

    Im not even a bad developer (okay some people would say otherwise) or a newbie of any sort, i just can't figure out why this doesn't work :( and if i find out how to do this can you tell how to have multiple buttons run different scripts?
     
  4. Intelligent thread starter macrumors 6502a

    Intelligent

    Joined:
    Aug 7, 2013
    #4
    Okay i found it out i never did selector to appdelgate, anyways, how do i do multiple scripts?

    EDIT: i figured that out to i just named it to onmybuttonhandler2.
     
  5. MacMaster1000, Sep 28, 2014
    Last edited: Sep 28, 2014

    MacMaster1000 macrumors newbie

    MacMaster1000

    Joined:
    Jul 24, 2014
    Location:
    Private!
    #5
    Here you go.

    Send a shell command through myButtonHandler_
    Code:
    osascript -e <your apple script code here>
    <your apple script code here> is your apple script code (ex: display dialog ...)
    Garret Stand
    OS X 10.5.8 leopard
     

Share This Page