• 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
selective selection in TextEdit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

selective selection in TextEdit


  • Subject: selective selection in TextEdit
  • From: yvan-koenig <email@hidden>
  • Date: Wed, 9 Feb 2005 12:01:36 +0100

Hello

I am able to "select all" in a TextEdit document's winow.

Is it a way to select only a group of paragraphs ?

I am able to grab the paragraphs contents but which to cut the paragraphs as rich text (with styles…)

Thanks in adavance.

property theApp : "textEdit"
property gui99 : "UI element scripting is not enabled. " & ¬
	"Check “Enable access for assistive devices”"

(* doc is an alias to a html file *)
set doc to "Macintosh HD:Users:yvankoenig:Desktop:concise.html"

tell application theApp
	launch
	open alias (doc as text)
	tell document 1

		-- my toutSelectionnerGUI(

		(* is it a way to do this partial selection ??
		set the selection to paragraphs 1 thru 10
		*)

		--	my couperGUI()

	end tell -- document 1
end tell -- theApp


-- ==================

on GUImissing()
	tell application "System Preferences"
		activate
		set current pane to ¬
			pane "com.apple.preference.universalaccess"
		display dialog gui99
	end tell -- to System Preferences
end GUImissing

-- ==================

on keystrokesGUI(liste)
tell application "System Events"
if UI elements enabled then
set frontmost of process theApp to true
tell process theApp
repeat with k in liste
set ks to k as list (* for safe, useful for chars with no modifier *)
if (count of ks) is 1 then
keystroke (ks's item 1)
else if ks's item 2 is "c" then
keystroke (ks's item 1) using command down
else if ks's item 2 is "s" then
keystroke (ks's item 1) using shift down
else if ks's item 2 is "cs" then
keystroke (ks's item 1) using {shift down, command down}
end if
end repeat
end tell -- to process
else
my GUImissing()
end if
end tell -- to System Events
end keystrokesGUI


-- ==================

on toutSelectionnerGUI()
	my keystrokesGUI({{"a", "c"}}) (* cmd - w *)
end toutSelectionnerGUI

-- ==================

on couperGUI()
	my keystrokesGUI({{"x", "c"}, return}) (* cmd + p, return *)
end couperGUI

-- ==================

Yvan KOENIG

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: selective selection in TextEdit
      • From: Andrew Oliver <email@hidden>
  • Prev by Date: Re: where are the shell scripts ?
  • Next by Date: Localization of Date
  • Previous by thread: Re: reading a CSV file
  • Next by thread: Re: selective selection in TextEdit
  • Index(es):
    • Date
    • Thread