• 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: "koenig.yvan" <email@hidden>
  • Date: Thu, 01 Aug 2013 11:56:00 +0200


Le 01/08/2013 à 00:56, Jim Brandt <email@hidden> a écrit :

I dislike the fact that when I print from the AS Editor, the text size is so big. There's not an option to format the printed output in a different text size than what is used in the Editor.

So, I'm trying to write a script that grabs the contents of the Editor's front window using a copy command to preserve the formatting of the Editor and pasting it into a Tex-Edit Plus document where I can decrease the font size. I created this script and saved it as an application.

When I open a script and have it in the front window, then run the app from the script menu pulldown, I get the current contents of the clipboard.

### 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?

TIA,

Jim

Hello

I just used TextEdit because I don't own Text-Edit Plus.

tell application "AppleScript Editor"
activate
tell document 1
set WindowName to name
tell application "System Events"
tell process "AppleScript Editor"
keystroke "a" using {command down}
delay 0.2
keystroke "c" using {command down}
end tell
end tell
end tell
end tell
tell application "TextEdit"
activate
make new document --with properties {name:WindowName & ".rtf"}
end tell
tell application "System Events" to tell process "TextEdit"
keystroke "v" using {command down}
end tell
tell application "TextEdit" to tell document 1
set size of every character to 8
save in file ((path to desktop as text) & WindowName & ".rtf")
close
end tell

I saved the script as an application.
I didn't checked but I guess that if you store it in the System's Scripts menu it would work also stored as Script.

KOENIG Yvan (VALLAURIS, France) jeudi 1 août 2013 11:54:58



 _______________________________________________
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

  • Prev by Date: Moving & deleting a mailbox in Mail
  • Next by Date: Re: Copying text from the AS Editor
  • Previous by thread: Moving & deleting a mailbox in Mail
  • Next by thread: Re: Copying text from the AS Editor
  • Index(es):
    • Date
    • Thread