• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Copying text from the AS Editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying text from the AS Editor


  • Subject: Re: Copying text from the AS Editor
  • From: Nigel Garvey <email@hidden>
  • Date: Thu, 01 Aug 2013 11:30:11 +0100

Jim Brandt wrote on Wed, 31 Jul 2013 17:56:01 -0500:

>I created this script and saved it as an application.

>### Use cut & paste to keep color formatting
>tell application "AppleScript Editor"
>    tell document 1
>        set WindowName to name
>        tell application "System Events"
>            tell process "AppleScript Editor"
>                click menu item "Select All" of menu 1 of menu bar item
>"Edit" of menu bar 1
>                click menu item "Copy" of menu 1 of menu bar item
"Edit" of
>menu bar 1
>            end tell
>        end tell
>    end tell
>end tell
>
>tell application "Tex-Edit Plus"
>    make new document with properties {name:WindowName}
>    activate
>    tell front window
>        tell application "System Events" to tell process "Tex-Edit Plus"
>            click menu item "Paste" of menu 1 of menu bar item "Edit" of
>menu bar 1
>        end tell
>        select text of front window
>        set size of selection to 8
>        select insertion point before character 1
>    end tell
>end tell
>
>Any clues as to why I can't get the text from the Editor?

When you run the script applet, it'll be the frontmost application. You
need _AppleScript Editor_ to be frontmost for the GUI stuff to work:

  ### Use cut & paste to keep color formatting
  tell application "System Events"
    tell application process "AppleScript Editor"
      set frontmost to true
      set WindowName to name of window 1
      click menu item "Select All" of menu 1 of menu bar item "Edit" of menu bar 1
      click menu item "Copy" of menu 1 of menu bar item "Edit" of menu bar 1
    end tell
  end tell

  tell application "Tex-Edit Plus"
    make new document with properties {name:WindowName}
    activate
    tell front window
      tell application "System Events" to tell process "Tex-Edit Plus"
        click menu item "Paste" of menu 1 of menu bar item "Edit" of menu bar 1
      end tell
      select text of front window
      set size of selection to 8
      select insertion point before character 1
    end tell
  end tell

NG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: Copying text from the AS Editor
      • From: Nigel Garvey <email@hidden>
  • Prev by Date: Re: Copying text from the AS Editor
  • Next by Date: Re: Copying text from the AS Editor
  • Previous by thread: Re: Copying text from the AS Editor
  • Next by thread: Re: Copying text from the AS Editor
  • Index(es):
    • Date
    • Thread