Couple of Xcode questions

Discussion in 'Apple' started by JF Mezei, Apr 22, 2014.

  1. JF Mezei

    JF Mezei Guest

    So, I am wasting much time trying to get a simple AppleScriptObjC to
    run. :-(

    Question: Is there a magic incantation to change the font of the
    displayed code ?

    Edit -> Format -> Font -> Show fonts lets you choose fonts, but no
    change to code.

    Similarly, Edit -> Format -> Font -> Bigger has no effect,

    When it gets late, one has to get bigger font (especially since turning
    off text colouring has no effect, Xcode continues to insist to colour it).



    Secondly, when compiling the Appescipt, is it normal that the only
    details of a compilation error would be hidden into a pane you have to
    click on and reveal:

    slideprintAppDelegate.applescript:30: error: Expected “,” or “)” but
    found identifier. (-2741)
    Command /usr/bin/osacompile failed with exit code 1


    I would have thought a modern IDE would have had some flashing arrow
    pointing to the error in the source code. Yet, I find no indication of
    where in the applescript an error was found.


    Or did Apple disable the goodies between 3.1 and 3.2 to force people to
    bguy Xcode 4 and beyond ?



    Also, while I am at it, since there appears to be no debgger support for
    Applescript, I am resorting to "display dialog". However, is there a
    trick to display a numeric value ?

    for instance:

    set x to 24
    display dialog x

    (I tried many incantations, but lack of proper compiler errors means I
    operate in the dark).
     
    JF Mezei, Apr 22, 2014
    #1
    1. Advertisements

  2. JF Mezei

    JF Mezei Guest

    I hate these newfangled languages with insufficient documentation.

    Seems that contrary to what they say, "set myvar to 1" is not sufficient
    to declare a variable.

    In an AppleScriptObjC environment, it appears no code executes by
    default. And it *appears* that the "on <event> <code> end" blocks are
    treatead as subroutines, so if you want variables to be accessible
    accross those blocks, they have to be declared as "global" at the top of
    program.

    (The doc and examples all said that a "set myvar to 1" at the top was
    enough to declare the variable).

    Also, it appears that the automatic coversion from number to string as
    some of the documentation alludes is not so automatic.

    my display dialog of a number was failing because the variable had not
    been initialised and not availble to that block :)

    display dialog myvariable as string

    does the trick.



    Hours wasted because of that newfangled documentation. Long live the VMS
    wall where you got the whole story on how stuff worked.

    And now, I will have fun trying to integrate the serial port support. It
    is likely 32 bits, and if I can't recompile it to 64 bits will have to
    create my small simple app as 32 bits.



    BTWm the "number formatter" in interface builder is really really basic.
    It lets you enter anything of any length and only validates once you try
    to leave the field. 1980s character cell tech did this live as you typed
    and wouldn't let you enter a letter in a numeric field.
     
    JF Mezei, Apr 22, 2014
    #2
    1. Advertisements

  3. JF Mezei

    JF Mezei Guest

    Ok, so this serial interface to appelscript provides and ".OSAX" file
    put into scripting additions.

    How does one add this to an xcode project ? (apparently it has a
    dictionary with the valid statements etc, which would be visible in the
    applescript editor, but not sure how this works in Xcode)
     
    JF Mezei, Apr 22, 2014
    #3
  4. JF Mezei

    Lewis Guest

    In message <535604c4$0$22465$c3e8da3$>
    JF Mezei <> wrote:
    > So, I am wasting much time trying to get a simple AppleScriptObjC to
    > run. :-(


    > Question: Is there a magic incantation to change the font of the
    > displayed code ?


    In what editor?

    > Secondly, when compiling the Appescipt, is it normal that the only
    > details of a compilation error would be hidden into a pane you have to
    > click on and reveal:


    Um, that's not how script editor behaves for me, but you didn't say what
    you were using.

    > slideprintAppDelegate.applescript:30: error: Expected “,†or “)†but
    > found identifier. (-2741)
    > Command /usr/bin/osacompile failed with exit code 1


    osacompile? Are you writing in Xcode? Don't do that. Script Editor works
    very well for almost all AppleScript work. You only want to resort to
    XCode if you are building something complicated with lots of files. A
    UI. Stuff like that.

    > Or did Apple disable the goodies between 3.1 and 3.2 to force people to
    > bguy Xcode 4 and beyond ?


    You are using XCODE 3?!? The current version is 5.1.1

    And yes, I'm sure Apple is very interested in the income derived from
    forcing people to buy $0 upgrades to XCode.

    > Also, while I am at it, since there appears to be no debgger support for
    > Applescript, I am resorting to "display dialog". However, is there a
    > trick to display a numeric value ?


    > for instance:


    > set x to 24
    > display dialog x


    To the best of my recollection:

    display dialog (x as text) giving up after 5 seconds

    --
    I get the feeling that some people's idea of heaven is an "I told you
    so" T-shirt - mmalc
     
    Lewis, Apr 22, 2014
    #4
  5. JF Mezei

    Don Bruder Guest

    In article <>,
    Lewis <> wrote:

    > In message <535604c4$0$22465$c3e8da3$>
    > JF Mezei <> wrote:
    > > So, I am wasting much time trying to get a simple AppleScriptObjC to
    > > run. :-(

    >
    > > Question: Is there a magic incantation to change the font of the
    > > displayed code ?

    >
    > In what editor?
    >
    > > Secondly, when compiling the Appescipt, is it normal that the only
    > > details of a compilation error would be hidden into a pane you have to
    > > click on and reveal:

    >
    > Um, that's not how script editor behaves for me, but you didn't say what
    > you were using.
    >
    > > slideprintAppDelegate.applescript:30: error: Expected "," or ")" but
    > > found identifier. (-2741)
    > > Command /usr/bin/osacompile failed with exit code 1

    >
    > osacompile? Are you writing in Xcode? Don't do that. Script Editor works
    > very well for almost all AppleScript work. You only want to resort to
    > XCode if you are building something complicated with lots of files. A
    > UI. Stuff like that.
    >
    > > Or did Apple disable the goodies between 3.1 and 3.2 to force people to
    > > bguy Xcode 4 and beyond ?

    >
    > You are using XCODE 3?!? The current version is 5.1.1
    >
    > And yes, I'm sure Apple is very interested in the income derived from
    > forcing people to buy $0 upgrades to XCode.


    Nope, they're more interested in the income from forcing people to buy
    the $whatever-the-price-is-today machine that *CAN* run the newest
    XCode.

    --
    Security provided by Mssrs Smith and/or Wesson. Brought to you by the letter Q
     
    Don Bruder, Apr 22, 2014
    #5
  6. JF Mezei

    nospam Guest

    In article <lj64b6$lkd$>, Don Bruder <>
    wrote:

    > > > Or did Apple disable the goodies between 3.1 and 3.2 to force people to
    > > > bguy Xcode 4 and beyond ?

    > >
    > > You are using XCODE 3?!? The current version is 5.1.1
    > >
    > > And yes, I'm sure Apple is very interested in the income derived from
    > > forcing people to buy $0 upgrades to XCode.

    >
    > Nope, they're more interested in the income from forcing people to buy
    > the $whatever-the-price-is-today machine that *CAN* run the newest
    > XCode.


    xcode runs just fine on 5 year old macs, which means your statement is
    complete bullshit.
     
    nospam, Apr 22, 2014
    #6
  7. JF Mezei

    JF Mezei Guest

    I was under the impression that the last "free" version of xcode was 3.2
    and that starting with 4, once needed a paid subscription to apple
    developper to get the free xcode.

    Is that still the case, or is xcode now freely downloadable again ?

    would xcode 5 work on Snow Leopard ?

    The normal Applescript Editor does not provide access to the Interface
    Builder. It is means to script existing applications instead of building
    a standalone one.

    The use of Xcode is required when you want to attach a GUI (interface
    buioder) to an applescript application.
     
    JF Mezei, Apr 22, 2014
    #7
  8. JF Mezei

    nospam Guest

    In article <5356c147$0$46374$c3e8da3$>, JF
    Mezei <> wrote:

    > I was under the impression that the last "free" version of xcode was 3.2
    > and that starting with 4, once needed a paid subscription to apple
    > developper to get the free xcode.
    >
    > Is that still the case, or is xcode now freely downloadable again ?


    you remember wrong. xcode is free with any level developer account,
    including free) and also available for free on the app store.

    > would xcode 5 work on Snow Leopard ?


    mountain lion required.
     
    nospam, Apr 22, 2014
    #8
  9. JF Mezei

    JF Mezei Guest

    On 14-04-22 15:36, nospam wrote:

    > you remember wrong. xcode is free with any level developer account,
    > including free) and also available for free on the app store.



    OK, I need to add parity to my memory :-(

    I was pretty sure at one point Apple started to require paid developper
    subscriptions for Xcode upgrades (hence why I stopped bothering after
    Xcode 3.2)
     
    JF Mezei, Apr 22, 2014
    #9
  10. JF Mezei

    nospam Guest

    In article <5356ccb4$0$61339$c3e8da3$>, JF
    Mezei <> wrote:

    > > you remember wrong. xcode is free with any level developer account,
    > > including free) and also available for free on the app store.

    >
    > OK, I need to add parity to my memory :-(
    >
    > I was pretty sure at one point Apple started to require paid developper
    > subscriptions for Xcode upgrades (hence why I stopped bothering after
    > Xcode 3.2)


    they didn't.

    however, they did briefly charge for xcode on the app store, but all
    you had to do was register as a free developer and get it for free that
    way.
     
    nospam, Apr 22, 2014
    #10
  11. JF Mezei

    Lewis Guest

    In message <lj64b6$lkd$>
    Don Bruder <> wrote:
    > In article <>,
    > Lewis <> wrote:


    >> In message <535604c4$0$22465$c3e8da3$>
    >> JF Mezei <> wrote:
    >> > So, I am wasting much time trying to get a simple AppleScriptObjC to
    >> > run. :-(

    >>
    >> > Question: Is there a magic incantation to change the font of the
    >> > displayed code ?

    >>
    >> In what editor?
    >>
    >> > Secondly, when compiling the Appescipt, is it normal that the only
    >> > details of a compilation error would be hidden into a pane you have to
    >> > click on and reveal:

    >>
    >> Um, that's not how script editor behaves for me, but you didn't say what
    >> you were using.
    >>
    >> > slideprintAppDelegate.applescript:30: error: Expected "," or ")" but
    >> > found identifier. (-2741)
    >> > Command /usr/bin/osacompile failed with exit code 1

    >>
    >> osacompile? Are you writing in Xcode? Don't do that. Script Editor works
    >> very well for almost all AppleScript work. You only want to resort to
    >> XCode if you are building something complicated with lots of files. A
    >> UI. Stuff like that.
    >>
    >> > Or did Apple disable the goodies between 3.1 and 3.2 to force people to
    >> > bguy Xcode 4 and beyond ?

    >>
    >> You are using XCODE 3?!? The current version is 5.1.1
    >>
    >> And yes, I'm sure Apple is very interested in the income derived from
    >> forcing people to buy $0 upgrades to XCode.


    > Nope, they're more interested in the income from forcing people to buy
    > the $whatever-the-price-is-today machine that *CAN* run the newest
    > XCode.


    Strange, since my 5+ year old laptop runs XCode 5 just fine.

    --
    IT'S POTATO, NOT POTATOE Bart chalkboard Ep. 7F01
     
    Lewis, Apr 23, 2014
    #11
  12. JF Mezei

    Alan Baker Guest

    On 2014-04-22 07:56:51 +0000, JF Mezei said:

    > Ok, so this serial interface to appelscript provides and ".OSAX" file
    > put into scripting additions.
    >
    > How does one add this to an xcode project ? (apparently it has a
    > dictionary with the valid statements etc, which would be visible in the
    > applescript editor, but not sure how this works in Xcode)


    Why not just do it in AppleScript?
     
    Alan Baker, Apr 23, 2014
    #12
  13. JF Mezei

    Alan Baker Guest

    On 2014-04-22 19:21:43 +0000, JF Mezei said:

    > I was under the impression that the last "free" version of xcode was 3.2
    > and that starting with 4, once needed a paid subscription to apple
    > developper to get the free xcode.
    >
    > Is that still the case, or is xcode now freely downloadable again ?
    >
    > would xcode 5 work on Snow Leopard ?
    >
    > The normal Applescript Editor does not provide access to the Interface
    > Builder. It is means to script existing applications instead of building
    > a standalone one.
    >
    > The use of Xcode is required when you want to attach a GUI (interface
    > buioder) to an applescript application.


    Hey... ...here's a CRAZY thought.

    Why don't you actually check some of these things out...

    ....for yourself?
     
    Alan Baker, Apr 23, 2014
    #13
  14. JF Mezei

    JF Mezei Guest

    On 14-04-23 13:11, Alan Baker wrote:

    > Hey... ...here's a CRAZY thought.
    >
    > Why don't you actually check some of these things out...



    not easy because most of Google stuff on Applescript/Xcode interface
    predates the change from Applescript Studio to ApplescriptOBJC.

    And I had to do my own testing to find out that for Applescript Editor,
    scripting additions placed in the Library/Scripting Additions are
    automatically available to the Applescript app. Now, I must do the same
    to see if they are also available to the AppleScriptObjC in Xcode.

    I was hoping someone had gone through this before and could give some
    hints that would have saved me archeological digs that have taken hours
    so far to learn a tech that was meant to allow me to do this simple task
    in a couple of minutes.
     
    JF Mezei, Apr 23, 2014
    #14
  15. JF Mezei

    JF Mezei Guest

    On 14-04-23 19:38, Alan Baker wrote:

    > "Installation:
    >
    > Copy SerialPort X.oasx to ~/Library/ScriptingAdditions/ for a single
    > user or /Library/ScriptingAdditions/ for multiple users
    > ( ~ indicates your home folder).


    AppleScript Editor has a "open dictionary" function. Xcode doesn't.
    AppleScript Editor automatically finds files in Scripting Additions.
    There is no documentation on whether Xcode does that or not.

    There is documentation on how to produce a scripting addition in Xcode,
    but not how to use one.
     
    JF Mezei, Apr 24, 2014
    #15
  16. JF Mezei

    Alan Baker Guest

    On 2014-04-24 01:46:44 +0000, JF Mezei said:

    > On 14-04-23 19:38, Alan Baker wrote:
    >
    >> "Installation:
    >>
    >> Copy SerialPort X.oasx to ~/Library/ScriptingAdditions/ for a single
    >> user or /Library/ScriptingAdditions/ for multiple users
    >> ( ~ indicates your home folder).

    >
    > AppleScript Editor has a "open dictionary" function. Xcode doesn't.


    So use AppleScript Editor.

    I've written most of the script while you've been making excuses.

    > AppleScript Editor automatically finds files in Scripting Additions.
    > There is no documentation on whether Xcode does that or not.
    >
    > There is documentation on how to produce a scripting addition in Xcode,
    > but not how to use one.


    So use AppleScript Editor.

    I've written most of the script while you've been making excuses.
     
    Alan Baker, Apr 24, 2014
    #16
  17. JF Mezei

    JF Mezei Guest

    On 14-04-23 23:58, Alan Baker wrote:

    > So use AppleScript Editor.


    Repeating for the Xth time: AppleScript Editor does not allow building
    against interface builder. You need Xcode for that.

    You need Xcode to link the properties defined in Applescript to the
    fields in interface builder, and the buttons in interface builder to the
    "on" code blocks in AppleScript.

    Unless of fcourse I read wrong and that capability also exists in
    AppleScript Editor along with all the AppleScriptObjC extensions needed
    to work with interface builder's Cocia interface.


    BTW, Xcode does seem to find the osax in /Library/ScriptAdditions
    without having to add it to the project. Not very obvious in a IDE where
    you are expected to explicitely specify all the libraries a project uses.

    Will now have to try to run this on the server where there are real
    serial ports.

    But now, I have to figure out a way to bind the "return" key to a
    button. IT seems to want it binded to a text field.
     
    JF Mezei, Apr 24, 2014
    #17
  18. JF Mezei

    JF Mezei Guest

    I've had some success.

    It is interesting that running the script on a machine without the
    serial port entension does not generate any errors, except that the log
    does have complaint about missing variable (which has been defined).


    Also, when there is such an error in the

    on applicationShouldTerminate_(sender)
    if theport > 0 then serialport close theport
    return current application's NSTerminateNow
    end applicationShouldTerminate_


    Then you must "force quit" the application, because of the error in the
    "quit" code (complains about undeclared theport, but really about
    missing definition of "serialport".



    Once I got all setup on the server, the app was able to send data to the
    serial port. Hurray !. But it does log this message to the console:

    14-04-24 03:32:14 slideprint[13337] Performance: Please update this
    scripting addition to supply a value for ThreadSafe for each event
    handler: "/Library/ScriptingAdditions/SerialPort X.osax"


    The source to that serial port osax is not provided. Is there a way to
    fix it ? I can live with this as this app should not be used that many
    times.
     
    JF Mezei, Apr 24, 2014
    #18
  19. JF Mezei

    Paul Sture Guest

    On 2014-04-24, JF Mezei <> wrote:
    > I've had some success.


    <snip>

    >
    > Once I got all setup on the server, the app was able to send data to the
    > serial port. Hurray !. But it does log this message to the console:
    >
    > 14-04-24 03:32:14 slideprint[13337] Performance: Please update this
    > scripting addition to supply a value for ThreadSafe for each event
    > handler: "/Library/ScriptingAdditions/SerialPort X.osax"
    >
    >
    > The source to that serial port osax is not provided. Is there a way to
    > fix it ? I can live with this as this app should not be used that many
    > times.


    I missed this thread when it was current, and would have suggested Python
    instead. The advantages with Python are that there are tons of libraries
    available AND lots of questions and answers on the likes of Stack Overflow.

    --
    Paul Sture

    The final step of #heartbleed recovery is to call your mother, and advise
    her to change her maiden name -- @gojomo
     
    Paul Sture, May 10, 2014
    #19
  20. In article <>,
    Paul Sture <> wrote:

    > On 2014-04-24, JF Mezei <> wrote:
    > > I've had some success.

    >
    > <snip>
    >
    > >
    > > Once I got all setup on the server, the app was able to send data to the
    > > serial port. Hurray !. But it does log this message to the console:
    > >
    > > 14-04-24 03:32:14 slideprint[13337] Performance: Please update this
    > > scripting addition to supply a value for ThreadSafe for each event
    > > handler: "/Library/ScriptingAdditions/SerialPort X.osax"
    > >
    > >
    > > The source to that serial port osax is not provided. Is there a way to
    > > fix it ? I can live with this as this app should not be used that many
    > > times.

    >
    > I missed this thread when it was current, and would have suggested Python
    > instead. The advantages with Python are that there are tons of libraries
    > available AND lots of questions and answers on the likes of Stack Overflow.


    So Python is the next new shiny thing(tm). I've been using perl for at
    least at decade, mostly because it's so extensible, has a huge number of
    modules for everything under the sun, and it's been around for so long.
    I mentioned perl to a Objective C/java developer and he made a face
    (varkripta punim actually).

    Not to start a language flamewar, but why Python over something else?
    Usually, I say "write it in the language you know best".

    Just curious.

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...
    [I filter all Goggle Groups posts, so any reply may be automatically ignored]
     
    Michael Vilain, May 10, 2014
    #20
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. mike
    Replies:
    0
    Views:
    451
  2. Replies:
    0
    Views:
    559
  3. jamie
    Replies:
    0
    Views:
    547
    jamie
    Jul 11, 2003
  4. Fred Mau
    Replies:
    2
    Views:
    562
    Fred Mau
    Mar 21, 2005
  5. User N
    Replies:
    1
    Views:
    406
    Nicholas Andrade
    Jan 11, 2006
  6. Keith
    Replies:
    0
    Views:
    351
    Keith
    Dec 5, 2003
  7. flekso

    couple of questions

    flekso, Dec 27, 2003, in forum: PC Hardware
    Replies:
    0
    Views:
    464
    flekso
    Dec 27, 2003
Loading...