• 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: Auto Print
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto Print


  • Subject: Re: Auto Print
  • From: "Marc K. Myers" <email@hidden>
  • Date: Wed, 10 Jan 2001 13:51:02 -0500
  • Organization: [very little]

Peter Mathiessen wrote:
> Date: Wed, 10 Jan 2001 13:03:12 +0100
> Subject: Auto Print
> From: Peter Mathiessen <email@hidden>
> To: <email@hidden>
>
> Hi,
>
> I4m trying to write a script that will take a bunch of files from one
> folder, open them in Tex-Edit Plus. Print them and then move them to another
> folder.
>
> I have two problems;
>
> 1. Tex-Edit Plus will not open them, instead MacOS text tool opens them (the
> files are of type: TEXT and creator: ttxt).
>
> 2. The printout dialog is popping up, I want to print with no user
> interaction.
>
> The script:
>
> tell application "Finder"
> activate
> set searchFolder to alias "Macintosh HD:to_print:"
> set destfolder to alias "Macintosh HD:printed_files:"
> set myList to list folder searchFolder without invisibles
> repeat with myfilename in every item in myList
> set myfile to alias ("Macintosh HD:to_print:" & myfilename)
> tell application "Tex-Edit Plus"
> activate
> open myfile
> print window 1
> close window 1 saving no
> move myfile to destfolder
> end tell
> end repeat
> end tell

There is only one command in your script that should be executed by the
Finder, so why is the whole thing in a Finder "tell"? That's the cause
of it opening the files in the wrong program. Your repeat statement is
unnecessarily complex: "repeat <listVariable> in <list>" is all you
need. Finally, "print one copy" is the TE+ command that enables you to
bypass the print dialog. (And you don't need to "activate" TE+.) My
version of your script looks like this:

set searchFolder to alias "SuperMac HD:Desktop Folder:In:"
set destfolder to alias "SuperMac HD:Desktop Folder:Out:"
set myList to list folder searchFolder without invisibles
repeat with myfilename in myList
set myfile to alias ("SuperMac HD:Desktop Folder:In:" & myfilename)
tell application "Tex-Edit Plus"
open myfile
print one copy window 1
close window 1 saving no
tell application "Finder" to move myfile to destfolder
end tell
end repeat

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[1/10/01 1:49:29 PM]


  • Prev by Date: Re: Re: Highlights of AppleScript 1.5.5 in Mac OS 9.1
  • Next by Date: os 9.1
  • Previous by thread: a script to get xy measurements of images with QT
  • Next by thread: os 9.1
  • Index(es):
    • Date
    • Thread