• 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: Tell print/close to the frontmost app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell print/close to the frontmost app


  • Subject: Re: Tell print/close to the frontmost app
  • From: John Delacour <email@hidden>
  • Date: Thu, 19 Sep 2002 14:14:08 +0100

At 11:10 pm +1200 19/9/02, Andy Wylie wrote:

on Thu, 19 Sep 2002 03:22:33 -0700 Stephane ODUL wrote:

Hi, I want to tell to the frontmost app to close (window, document,
just same as command++W), and print (like command++P).

try this...

tell application "Finder"
set x to (every process whose frontmost = true) as +AKs-class psn +ALs
end tell

tell x
close the front window
end tell

Only one thuh?

That no longer works with OS X, and luckily OS X doesn't need that coercion any more. In this case, since print and close are core verbs, it's possible to use the name.


tell application "Finder"
set varApp to "" & (name of processes where it is frontmost)
end tell
tell application varApp to close window 1

-- JD


Here's that UTF-7 converter script for Mail users. :-)


(* Display a UTF-7 encoded Mail message as Unicode in TextEdit *)
set {d, tmp} to {current date, path to temporary items}
set n to d - (get date (("1/1/" & (d's year) ++ 1)))
set f to "" & tmp & "MAIL" & n & ".txt"
set {Ocode, Ucode, Usig} to {"unicode-2-0-utf-7", "unicode-2-0", "+AtsCxw"}
tell app "Mail"
set s to the content of the first item of (get the selection)
end
if class of s is Unicode text then set s to +AKs-class ktxt+ALs of (s as record)
set s to TECConvertText s fromCode Ocode toCode Ucode
open for access file f with write permission
write Usig to file f
write s to file f
close access file f
tell app "Finder"
open file f using application file id "com.apple.textedit"
end
tell app "TextEdit" to activate
_______________________________________________
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: Tell print/close to the frontmost app (uh-uh, JD)
      • From: Mr Tea <email@hidden>
References: 
 >Re: Tell print/close to the frontmost app (From: Andy Wylie <email@hidden>)

  • Prev by Date: OS X running?
  • Next by Date: Re: Two related questions:
  • Previous by thread: Re: Tell print/close to the frontmost app
  • Next by thread: Re: Tell print/close to the frontmost app (uh-uh, JD)
  • Index(es):
    • Date
    • Thread