• 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: Missing something obvious
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing something obvious


  • Subject: Re: Missing something obvious
  • From: Mark Ratledge <email@hidden>
  • Date: Sat, 12 Dec 2009 18:55:35 -0700

Tried all those property selectors in Pages; no difference. "set the_url to contents of «class pSel» of document 1" works fine outside of the if else loop. The problem is still with the if else loop; the script blows right by it.


set the_title to the clipboard

tell application "System Events"
	set myApp to name of first application process whose frontmost is true

	if myApp is "Pages" then
		tell application "Pages"
			set the_url to the selection as text
		end tell

	else if myApp is "BBEdit" then
		tell application "BBEdit"
			set the_url to the selection
		end tell
	else
		return
	end if
end tell


set the_text to " <a href=\"" & the_url & "\" title=\"" & the_title & "\" class=\"external\">" & the_title & "</a>"


set the clipboard to the_text


On Dec 12, 2009, at 4:24 PM, email@hidden wrote:

In Pages, selection is a property of the document, not the application, so you need to address the document. (Don't know why yours would work from the script menu).

tell application "Pages"
set the_url to contents of «class pSel» of document 1
end tell

All of these commands failed:
--set the_url to contents of «class pSel»
-- set the_url to get contents of the selection of document 1
-- set the_url to the selection of document 1
-- set the_url to the selection
_______________________________________________
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: Missing something obvious
      • From: Axel Luttgens <email@hidden>
    • Re: Missing something obvious
      • From: Deivy Petrescu <email@hidden>
    • Re: Missing something obvious
      • From: "email@hidden" <email@hidden>
References: 
 >Missing something obvious (From: Mark Ratledge <email@hidden>)

  • Prev by Date: Re: Missing something obvious
  • Next by Date: Re: Missing something obvious
  • Previous by thread: Re: Missing something obvious
  • Next by thread: Re: Missing something obvious
  • Index(es):
    • Date
    • Thread