• 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
Frontmost App and --Script Menu-- (oops)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Frontmost App and --Script Menu-- (oops)


  • Subject: Frontmost App and --Script Menu-- (oops)
  • From: Irwin Poche <email@hidden>
  • Date: Sun, 11 Apr 2004 19:36:10 -0500

I am almost finished (so I thought) making a script that will paste a URL from Safari. To do so, I need to get the frontmost application then use UI to do the Edit:Paste menu.

The script below does this - all but the UI Paste part. When run in Script Editor, the dialog displays "Script Editor" but when run from the 10.3.3's script menu, it says "System Events".

Can I do what I'm wanting to do and, if so, how ?

-Irwin



tell application "Safari"
set URLlist to {}
repeat with thisD in documents
set URLlist to URLlist & URL of thisD
end repeat
end tell

if (count of URLlist) = 1 then
set z to item 1 of URLlist
else if (count of URLlist) > 1 then
set z to choose from list URLlist without multiple selections allowed
else
set z to ""
beep
end if

set the clipboard to "<" & z & ">"

display dialog FrontmostApp()


on FrontmostApp()
tell application "System Events"
return (name of (every application process whose frontmost is true) as string)
end tell
end FrontmostApp
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Frontmost App and --Script Menu-- (oops)
      • From: Michael Terry <email@hidden>
  • Prev by Date: Frontmost App and
  • Next by Date: Re: Frontmost App and --Script Menu-- (oops)
  • Previous by thread: Frontmost App and
  • Next by thread: Re: Frontmost App and --Script Menu-- (oops)
  • Index(es):
    • Date
    • Thread