Practical joke help

  • Disclaimer: the code you are about to view is not well-formed or well-
    written.

    Good evening.

    I am trying to create an application that will perform a practical
    joke on a co-worker. I know my way around AppleScript fairly well,
    but my needs for this joke require the use of something more
    substantial, hence Cocoa. This I do not know.

    The app is intended to listen for the user to press the A, O or N
    keys. When one of these keys is pressed an image is to appear over
    all other windows for a brief second, then fade away. I have managed
    to pull together an event tap to listen for the key presses, create
    the window with image in it and wire up the interface with a controller.

    I have gotten stuck, however, and am not sure how to proceed. The app
    builds okay, but within about 2 minutes of running exits with status
    5. In the run log are several warnings about the lack of an
    autorelease pool and a message regarding an uncaught exception in the
    window controller. I do not understand what the messages about the
    pool are. I have ambiguous thoughts about the uncaught exception
    which I might be able to solve with hours of tinkering and googling.

    My questions are these: how can I resolve these entries in the run
    log; how can I get the showWindow method to fire correctly?

    http://pastie.caboo.se/129542

    Evan
  • your problem is the [MyWindowController showWindow]

    First: the method is "showWindow:", not "showWindow" (ie it takes a parameter)

    Second: it is an instance method, not a class method (ie you need to
    send it to an instance of your class)

    On 12/16/07, Evan Chaney <evanchaney...> wrote:
    > Disclaimer: the code you are about to view is not well-formed or well-
    > written.
    >
    > Good evening.
    >
    > I am trying to create an application that will perform a practical
    > joke on a co-worker. I know my way around AppleScript fairly well,
    > but my needs for this joke require the use of something more
    > substantial, hence Cocoa. This I do not know.
    >
    > The app is intended to listen for the user to press the A, O or N
    > keys. When one of these keys is pressed an image is to appear over
    > all other windows for a brief second, then fade away. I have managed
    > to pull together an event tap to listen for the key presses, create
    > the window with image in it and wire up the interface with a controller.
    >
    > I have gotten stuck, however, and am not sure how to proceed. The app
    > builds okay, but within about 2 minutes of running exits with status
    > 5. In the run log are several warnings about the lack of an
    > autorelease pool and a message regarding an uncaught exception in the
    > window controller. I do not understand what the messages about the
    > pool are. I have ambiguous thoughts about the uncaught exception
    > which I might be able to solve with hours of tinkering and googling.
    >
    > My questions are these: how can I resolve these entries in the run
    > log; how can I get the showWindow method to fire correctly?
    >
    > http://pastie.caboo.se/129542
    >
    > Evan
    >

    --
    Clark S. Cox III
    <clarkcox3...>
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today