Professional Web Applications Themes

AppleScript script to paste some text in the mostfront (key) window - Mac Programming

Don't know much in AppleScript... What is the script to paste some text in the mostfront (key) window (textfield). Thank you....

  1. #1

    Default AppleScript script to paste some text in the mostfront (key) window

    Don't know much in AppleScript...

    What is the script to paste some text in the mostfront (key) window (textfield).

    Thank you.
    Alain Guest

  2. #2

    Default Re: AppleScript script to paste some text in the mostfront (key)window

    Entity Alain Birtz spoke thus:
     
    Huh? What's "Key" window"? I use Tex-Edit as my editor, therefore I say:

    tell application "Tex-Edit Plus" to paste


    -- Gnarlie
    http://www.Gnarlodious.com/Cogent/Cogent.html

    Gnarlodious Guest

  3. #3

    Default Re: AppleScript script to paste some text in the mostfront (key) window

    Alain Birtz <ca> wrote:
     

    That depends upon what the frontmost application is. Many applications
    are not scriptable, and those that are might have different commands (or
    no command) for doing this. You might want to look into QuicKeys, or GUI
    scripting. You also might want to look about remedying your ignorance
    (see my sig). But on the whole a completely general solution is
    unlikely. m.

    --
    matt neuburg, phd = com, http://www.tidbits.com/matt/
    AppleScript: The Definitive Guide
    http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
    Read TidBITS! It's free and smart. http://www.tidbits.com
    matt Guest

  4. #4

    Default Re: AppleScript script to paste some text in the mostfront (key) window

    OK, more easy question:

    how to get (the name of) the mostfront (key) window or the key application ?



    In article <1g71bvq.jsm1p316fajf2N%com>, com
    (matt neuburg) wrote:
     
    >
    > That depends upon what the frontmost application is. Many applications
    > are not scriptable, and those that are might have different commands (or
    > no command) for doing this. You might want to look into QuicKeys, or GUI
    > scripting. You also might want to look about remedying your ignorance
    > (see my sig). But on the whole a completely general solution is
    > unlikely. m.[/ref]
    Alain Guest

  5. #5

    Default Re: AppleScript script to paste some text in the mostfront (key)window

    ca (Alain Birtz) writes:
     

    Not an "easy" question because you are using terminology that is
    alien to Macintosh. We do not use the term "key" in this manner. We
    do talk about "active" windows vs. "inactive" windows, the active
    window being the one that is in front of all the others. This is
    more complex in OS X than in OS 9 because the windows of different
    applications can be interleaved in OS X.

    Applescripts are normally directed to applications not to windows.
    The syntax is "tell application do such-and-such" not "tell window."
    You might be able to script the Finder to do something with the active
    window, however. I am not an Applescript whiz, but it might be
    possible to have a script that is essentially "tell Finder
    paste-from-Clipboard-to-active-window" (the latter not being a real
    Applescript command, of course, and only being there for mediocre
    illustrative purposes).

    Check the Finder Applescript dictionary to see what your options are,
    as well as the Applescript doentation.
    Tim Guest

  6. #6

    Default Re: AppleScript script to paste some text in the mostfront (key) window

    In article <local>,
    Tim McNamara <net> wrote:
     
    >
    > Not an "easy" question because you are using terminology that is
    > alien to Macintosh. We do not use the term "key" in this manner. We
    > do talk about "active" windows vs. "inactive" windows, the active
    > window being the one that is in front of all the others. This is
    > more complex in OS X than in OS 9 because the windows of different
    > applications can be interleaved in OS X.[/ref]

    'We' does not include Apple. See "Changing the Key and Main Windows" at
    <http://developer.apple.com/doentation/Cocoa/Conceptual/WinPanel/Tasks
    /ChangingMainKeyWindow.html>

    Reinder
    Reinder Guest

  7. #7

    Default Re: AppleScript script to paste some text in the mostfront (key)window

    Reinder Verlinde <invalid> writes:
     
    >>
    >> Not an "easy" question because you are using terminology that is
    >> alien to Macintosh. We do not use the term "key" in this manner.
    >> We do talk about "active" windows vs. "inactive" windows, the
    >> active window being the one that is in front of all the others.
    >> This is more complex in OS X than in OS 9 because the windows of
    >> different applications can be interleaved in OS X.[/ref]
    >
    > 'We' does not include Apple. See "Changing the Key and Main Windows"
    > at
    > <http://developer.apple.com/doentation/Cocoa/Conceptual/WinPanel/Tasks
    > /ChangingMainKeyWindow.html>[/ref]

    "We" includes basically normal Mac users, not developers. Normal Mac
    users don't generally talk about windows in the same way as people
    writing software.
    Tim Guest

  8. #8

    Default Re: AppleScript script to paste some text in the mostfront (key) window

    [Crossposted and follow-ups set to <news:alt.comp.lang.applescript>]

    In article <168.1.100>,
    ca (Alain Birtz) wrote:

    [...]
     

    Windows belong to applications and AppleScript implementation differs
    between applications.

    Assuming Mac OS X, you can ask System Events for the frontmost process:

    tell app "System Events"
    get every process whose frontmost is true
    end

    Then ask the result what is its frontmost window. Provided the
    application in question has implemented such a function, the syntax
    might be:

    -- pseudo code
    tell app "name of some app"
    get name of frontmost window
    -- or
    get name of every window whose frontmost is true
    -- or
    get name of window 1
    end

    It depends on the app and it may not be implemented at all (if only
    because not every application *has* windows, but might still be
    frontmost).


    Btw
    - for AppleScript <news:alt.comp.lang.applescript> is the place -
    Crossposted and follow-ups set accordingly
    - top posting is not appreciated here. Quote only what is needed to give
    your response context, and place your response directly beneath it.

    --
    Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
    Sander Guest

Similar Threads

  1. Create multi-line point text from applescript in CS
    By spike_grobstein@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 2
    Last Post: May 5th, 04:50 PM
  2. Get/Set Font of Text of Text Frame with AppleScript/AICS
    By Joseph_Briggs@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 1
    Last Post: March 4th, 10:52 PM
  3. How to run compiled AppleScript script from C
    By Alain in forum Mac Programming
    Replies: 3
    Last Post: November 19th, 02:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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