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

Missing something obvious


  • Subject: Missing something obvious
  • From: Mark Ratledge <email@hidden>
  • Date: Sat, 12 Dec 2009 15:43:45 -0700

Le 12 déc. 2009 à 21:12, Mark Ratledge a écrit :


I'm missing something very obvious....

This script returns the value of the_title to the clipboard, not the_text (under 10.4.11, if it makes a difference):

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

It's because, under 10.4.11, if you use the script from the Script Editor, the process at front is not Pages or BBedit but it is the Script Editor.

If you save the script as an Application (or better as a package), you will get the wanted result.

I have it saved as an application and run it from the script menu in the menu bar. The problem is the If loop to select myApp. This works fine from the script menu:



set the_title to the clipboard

tell application "Pages"
	set the_url to the selection
end tell

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



set the clipboard to the_text






_______________________________________________ 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: email@hidden
  • Prev by Date: How to get all layer (even in layer sets) in Photoshop
  • Next by Date: Application Bundle won't quit at Shutdown
  • Previous by thread: Re: Quark Bounds Not Working Like it did
  • Next by thread: Re: Missing something obvious
  • Index(es):
    • Date
    • Thread