Buddy API - Sending a keystroke

Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default Buddy API - Sending a keystroke

    Hey,

    I got Buddy API and am using the following method to send stuff to an
    outside App.

    on sendStuff me
    step1 = baActivateWindow(getAt(theWin, 1))
    baWaitForWindow(getAt(theWin, 1), "active", 300)
    if step1 = 1 then
    step2 = baSendKeys("{ENTER}")
    if step2 = 0 then
    step3 = baSendKeys(theMsg)
    if step3 = 0 then
    step4 = baSendKeys("{ENTER}")
    if step4 = 0 then
    step5 = baActivateWindow(baWinHandle())
    baWaitForWindow(baWinHandle(), "active", 300)
    else
    alert "mess up 4"&&step4
    end if
    else
    alert "mess up 3"&&step3
    end if
    else
    alert "mess up 2"&&step2
    end if
    else
    alert "mess up 1"&&step1
    end if
    end

    theMsg is a string and theWin is a list that has the correct windows
    handler.

    The problem is when this script is run, (for instance with WordPad being
    theWin), WordPad only halfway comes up (it was minimized), nothing is
    entered and the mouse locks. The only way to break out is to Ctrl+Alt+Del,
    and then the movie moves on, having not accomplished its job.

    Any ideas?

    W. Locke Morgan


    W. Locke Morgan Guest

  2. Similar Questions and Discussions

    1. Is there a right-indent tab keystroke?
      In Quark, you can use option-tab to right-align just a portion of a line of text and not affect the text in that line that appears before it (such as...
    2. Feather Keystroke - Photoshop OS X
      works like a charm, thanx macmanx
    3. help with keystroke navigation
      i'm very new to director, and wondering if anyone can provide code for this: when the user presses spacebar, the playhead advances to the next...
    4. Sending a keystroke to another App
      Hi, I am a psychology research assistant at a local university. I am using dirertor to present some video stimuli while the participants are...
    5. OT: how to send a keystroke to another program
      On Sat, 2003-08-02 at 00:01, Andrej Hocevar wrote: Just an idea, There was a thread not long ago about a virtual keyboard. I don't know how it...
  3. #2

    Default Re: Buddy API - Sending a keystroke

    > > I got Buddy API and am using the following method to send stuff to an
    > > outside App.
    > >
    > > on sendStuff me
    > > step1 = baActivateWindow(getAt(theWin, 1))
    > > baWaitForWindow(getAt(theWin, 1), "active", 300)
    > > if step1 = 1 then
    > > step2 = baSendKeys("{ENTER}")
    > > if step2 = 0 then
    > > step3 = baSendKeys(theMsg)
    > > if step3 = 0 then
    > > step4 = baSendKeys("{ENTER}")
    > > if step4 = 0 then
    > > step5 = baActivateWindow(baWinHandle())
    > > baWaitForWindow(baWinHandle(), "active", 300)
    > > else
    > > alert "mess up 4"&&step4
    > > end if
    > > else
    > > alert "mess up 3"&&step3
    > > end if
    > > else
    > > alert "mess up 2"&&step2
    > > end if
    > > else
    > > alert "mess up 1"&&step1
    > > end if
    > > end
    > >
    > > theMsg is a string and theWin is a list that has the correct windows
    > > handler.
    > >
    > > The problem is when this script is run, (for instance with WordPad being
    > > theWin), WordPad only halfway comes up (it was minimized), nothing is
    > > entered and the mouse locks. The only way to break out is to
    > Ctrl+Alt+Del,
    > > and then the movie moves on, having not accomplished its job.
    > >
    It sounds like the input is getting sent before the window is ready to
    receive it. I'm not familiar with Buddy but I sell and support MasterApp
    which has simulated keystrokes and mouse clicks, and that's usually the
    reason input doesn't work. That, or sending it to the wrong window.

    From the looks of your code you must have an exitframe loop that calls
    sendStuff at each stage. If you don't, that's your problem. You have to
    have some breathing space between each step. If you already do, then
    instead of baWaitForWindow you could try calling some other function in
    the exitframe that tells you when the window has finished drawing and only
    advance to the next step after that.

    There are a couple of example movies in the MasterApp section of downloads
    that send a sequence of simulated input that might help - the Window
    Message and Close Acrobat 4 dialog examples both send a sequence of input.

    [url]http://www.updatestage.com/xtras/xtradownloads.html[/url]

    Gretchen Macdowall
    [url]http://www.updatestage.com/[/url]
    Gretchen Macdowall Guest

  4. #3

    Default Re: Buddy API - Sending a keystroke

    Here: [url]http://www.mods.com.au/frameset.htm[/url]


    "davidC" <crouchorama@bigpond.com> wrote in message
    news:bjuoqv$30b$1@forums.macromedia.com...
    > What is Buddy Api?
    > can you post a link to it
    > it seems interesting
    > david

    W. Locke Morgan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139