3 Replies Latest reply: Feb 1, 2013 7:31 PM by Frank Caggiano
mac_dev Level 1 Level 1 (0 points)

I am trying to make an application apple scriptable. I have created a scripting definition by copying mail.sdef and modifying it to suit my needs as the documentation recommends. My app suite at this point only has one command in it. Here is the definition:

<suite name="NAZone" code="NAZN" description="Classes and commands for the Zone application">

 

  <command name="accountLogin" code="zONeLgIn" description="Triggers account login.">

            <cocoa class="LoginCommand"/>

  <parameter name="loginName" code="naun" type="text" optional="no" description="Specify the username for the account that you wish to log into">

  <cocoa key="LoginName"/>

  </parameter>

            <parameter name="passwordStr" code="napw" type="text" optional="no" description="Specify the account password you wish to log into">

  <cocoa key="PasswordStr"/>

  </parameter>

  </command>

 

 

  </suite>

 

 

I am not sure what is wrong with my definition above, but AppleScript Editor keeps complaining: "Expected end of line but found identifier." at the statement where command is invoked. Here is how my test sript looks like:

tell application "NAZone"

    launch

          try

          accountlogin loginName "test@mail.com" passwordStr "abcdef12345"

          on error errStr number errNum

          display dialog errStr & errNum

          end try

end tell

 

AppleScript Editor complains anything following the command name. I don't think my command is somehow recognized.

I new to making applications scriptable as well as apple scripting.


MacBook Pro, Mac OS X (10.7.5)
  • 1. Re: Apple script editor keeps rejecting my custom command as undefined parameter? What am I doing wrong?
    Frank Caggiano Level 7 Level 7 (23,815 points)

    Does your app show up in the Applescript Dictionary and if so what does it show for it?

  • 2. Re: Apple script editor keeps rejecting my custom command as undefined parameter? What am I doing wrong?
    mac_dev Level 1 Level 1 (0 points)

    Yes it does. I see the command listed under the suite name, shows the description. When I compare parsed view with other sample command description, for sample script teh parameter name and type are parenthesized, my command parameters are not. For exaple the  sample SimpleScriptingVerb, a command  appears like so:

    do command with argsv : run a command with a bunch of arguments

     

    do command with args text : a text parameter passed to the command

    [blinking boolean] : a boolean parameter.

    [preferred hand Left Hand/Right Hand] : a parameter using our enumeration.

    [prose text] : a text parameter.

    [ivalue integer] : an integer parameter.

    [rvalue real] : an real number parameter.

    → text : the direct parameter enclosed in quotes

     

     

     

    While my command looks so:

    accountLoginv : Triggers account login.

     

    accountLogin

    loginName text : Specify the username for the account that you wish to log into

    passwordStr text : Specify the account password you wish to log into

     

    I am not sure if lack of parenthesis is an indicator of any syntax issues with my sdef.

     


     


  • 3. Re: Apple script editor keeps rejecting my custom command as undefined parameter? What am I doing wrong?
    Frank Caggiano Level 7 Level 7 (23,815 points)

    My knowledge of this doesn't go much farther, sorry.  Are you a member of the paid developer program by any chance? If so you should get better help there.

     

    If not hopefully someone will come along that might have a better handle on this.

     

    I can suggest from a trouble shooting standpoint is to:

     

    1) really go over the modifications you made to the scripting definition. Typos have to be the number one source of errors in something like this.

     

    2) Try to simplify the problem. Perhaps just as a test try to add a scripting addition that takes no parameters or only one.

     

    3) Not sure the lack of brackets in your dictionary definition is significant. Looking at other definitions in the dictionary some have the brackets but some do not. Couldn't find a pattern but you might.

     

    4) Finally look into the Apple doc's. There Xcode and programming stuff has been good to me you might find an answer in there somewhere.

     

    good luck