• 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
Delay while printing is being done
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Delay while printing is being done


  • Subject: Delay while printing is being done
  • From: Peter Baxter <email@hidden>
  • Date: Mon, 18 Jun 2007 21:59:33 +1000

Hi people,

I have been working on a script that prints word files as PDF's.  The end result was reasonably effective, however I brought another issue to the fore.  Often when writing scripts I put in a delay of a second or two to ensure that the script does not start a process before another has finished.  The script below is an example.  This script would be much more reliable if it could detect when the printing process finished before attempting to close the file.

try
tell application "Finder" to set thisList to every file in the front window
repeat with i from 1 to the number of items in thisList
set thisItem to item i of thisList
tell application "Finder" to activate
open thisItem
delay 1
tell application "System Events"
keystroke "p" using command down -- print
delay 3
key code 36
delay 15  -->  How do I write a script that detects when it is safe to close the window?
tell application "System Events"
keystroke "w" using command down
end tell
end tell
end repeat
end try


How do I write a script that detects when it is safe to close the window?

Peter Baxter
email@hidden

"Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed."
President Dwight D. Eisenhower, April 16, 1953




 _______________________________________________
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

  • Prev by Date: Re: talking to external MySQL servers
  • Next by Date: Re: "as file specification" path syntax for a non-boot drive
  • Previous by thread: Re: Applescript grammar
  • Next by thread: INDESIGN: Changing Order of Swatches
  • Index(es):
    • Date
    • Thread