Script Printing with Dynamic # of Copies

32 messages Options
Embed this post
Permalink
1 2
Edward Callaghan

Unsubscribe

Reply Threaded More More options
Print post
Permalink
In reply to this post by Neil Ticktin-2
On 30 Aug 2007, at 15:35, Neil Ticktin wrote:

> Yeah -- I thought about that as well.  The only problem is that the  
> "flyer"
> is a full color graphic that will take time to rasterize.  So, I  
> was trying
> to avoid having to have the computer do that over and over again.
>
> Thanks!
>
>
> At 1:52 AM -0500 8/30/07, Richard S. Russell wrote:
>>
>>
>> Stupid but effective: Do a ScriptMaker script with 2 nested loops.
>> The outer loop runs thru the records, 1 at a time, and issues a
>> single "Print 1 copy" command from the "cover letter" layout. The
>> inner loop runs "numcopies" times, each pass thru the loop issuing a
>> "Print 1 copy" command from the "flyer" layout.
>>>
>> On 2007 Aug 29, at 22:24, Neil Ticktin wrote:
>>
>>> Good Evening.
>>>
>>> After several hours of web searching, and not finding the
>>> answer ... it's time for an email list post.
>>>
>>> Background:
>>> I have a database called "centers" with about 50-100 records.
>>> One of the fields is called "numcopies"
>>> One layout is called "cover letter"
>>> One layout is called "flyer"
>>> The two layouts are personalized for each record.
>>>
>>> Task:
>>> I'd like to run a script that goes through each of the records in
>>> the database.  For each record, I would like to print one copy of
>>> the cover letter (the layout called "cover letter").  After that
>>> one page is printed for a record, I want to print the flyer for
>>> each record ... but I want to print the number of copies specified
>>> by "numcopies" for that record.
>>>
>>> Simple Example:
>>> Let's say that we have two centers: LA and NY.  LA needs 50 copies
>>> of the flyer, and NY needs 25 copies of the flyer.  Remember, the
>>> flyers for each location are different not only by quantity, but
>>> that they are "personalized" (e.g., one flyer prints with LA on it,
>>> and the other with NY on it).
>>>
>>> I want to have a resulting stack of paper that looks like this:
>>>
>>> Single page cover letter to LA
>>> 50 copies of the flyer personalized to LA
>>> Single page cover letter to NY
>>> 25 copies of the flyer personalized to NY
>>>
>>> The problem:
>>> I'm happy for this to be in either ScriptMaker or AppleScript, but
>>> I've been unable to find a good solution.
>>>
>>> Clearly, I can print with ScriptMaker, but I cannot dynamically
>>> specify the copies.
>>>
>>> It's probably possible with AppleScript, but since I generally find
>>> AppleScript to be a "read only" language <g>, I could certainly use
>>> some examples to pilfer from. :)
>>>
>>> Thanks!
>>>
>>> Neil
>>
>


________________________________________________________________________
This e-mail (including any attachments) is intended only for the recipient(s) named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. Any statement and/or opinion not related to this company's business and  expressed in this message is that of the author. Space Air does not take any responsibility for the views of the author in any matter not related to the company's objectives.  We reserve the right to monitor all e-mail messages passing through our network.

This email has been scanned for all viruses by the MessageLabs SkyScan
service. www.messagelabs.com

Space Airconditioning Plc, a company registered in England number 1313460, 1a Opus Park, Moorfield Road, Guildford GU1 1SZ
________________________________________________________________________
Neil Ticktin-2

Re: Script Printing with Dynamic # of Copies

Reply Threaded More More options
Print post
Permalink
In reply to this post by Tim Mansour
To all,

Ben Waldie, of Automated Solutions, just posted this for me in another
forum.  Because this emulates the human intervention in the GUI, it works
... and I thought I would pass it along.

The PDF idea is something that Tim Mansour suggested on this list as well.

Thanks everyone!

Neil


-----------------------------------------------------------


Neil,

I just did a quick test...


tell application "Printer Setup Utility"
   set current printer to printer "HP Laser"
end tell

tell application "FileMaker Pro"
   print window 1 with copies 5
end tell


... and confirmed that FileMaker does indeed use the last printer that was
used, and not necessarily the printer that I have specified in the "Printer
Setup Utility".  To work around this issue, here are some suggestions...

a) You could use GUI scripting to simulate user interaction to select the
printer and type the number of copies into the print dialog.  For example:


tell application "System Events"
   tell process "FileMaker Pro"
       set frontmost to true
       keystroke "p" using command down
       repeat until window "Print" exists
       end repeat
       tell window "Print"
           keystroke "20" -- number of copies
           tell pop up button 3
               click
               tell menu 1
                   click menu item "HP Laser" -- Your printer name
               end tell
           end tell
           keystroke return -- depress the "Print" button
       end tell
   end tell
end tell


b) You could create a FileMaker script step that prints the layout to PDF,
and then have AppleScript take over, open the PDF in something, such as
Adobe Acrobat Professional, and print it X number of times from there.

Hope this helps.

-Ben
Neil Ticktin-2

Re: Script Printing with Dynamic # of Copies

Reply Threaded More More options
Print post
Permalink
In reply to this post by dwdc
At 9:46 PM -0700 8/30/07, Don Wieland wrote:

>on 8/30/07 8:52 PM, Neil Ticktin stated:
>
>> Don,
>>
>> Interesting idea.
>>
>> I believe that I understand the below -- and it does, as you say, produce
>> just one print job.  But, I still think it would make the biggest graphic
>> be rasterized repeatedly since it would be on different "pages".
>
>Do you know this for a fact? Don't kill it before you know it's true.

I will look at it again ... but I cannot imagine how it wouldn't be the
case.  There would be no other way for the print job to work.

>
>My point is you should explore a little bit more to come up with the best
>solution.

I have a brute force method -- printing each page one at a time.  That
worked for yesterday's run.

>> At this point, I've given up.  I believe that there's a bug in FileMaker
>> that does not allow it to accept the instruction from AppleScript.  So, I
>> just use a loop to print the same one page over and over.
>>
>> Takes forever to print ... but at least it's the computer's time, not
>>mine. :)
>
>I understand your frustration.  Take some advice from me:  If you don't have
>time to figure out something robust, pay someone a couple bucks to make it
>hum. In the long run (if time is money to you), you'll recoup what you gave
>up and more. ;-)

Yeah -- problem is that it wasn't worth that to me.

Thanks!

Neil
Hans Gunnarsson

Re: Script Printing with Dynamic # of Copies

Reply Threaded More More options
Print post
Permalink
In reply to this post by Neil Ticktin-2
Thank you for passing this on. It will probably save some of us quite  
a bit of time.

Kind regards
Hans


On 31.8.2007, at 14:15, Neil Ticktin wrote:

> To all,
>
> Ben Waldie, of Automated Solutions, just posted this for me in another
> forum.  Because this emulates the human intervention in the GUI, it  
> works
> ... and I thought I would pass it along.
>
> The PDF idea is something that Tim Mansour suggested on this list  
> as well.
>
> Thanks everyone!
>
> Neil
>
>
> -----------------------------------------------------------
>
>
> Neil,
>
> I just did a quick test...
>
>
> tell application "Printer Setup Utility"
>    set current printer to printer "HP Laser"
> end tell
>
> tell application "FileMaker Pro"
>    print window 1 with copies 5
> end tell
>
>
> ... and confirmed that FileMaker does indeed use the last printer  
> that was
> used, and not necessarily the printer that I have specified in the  
> "Printer
> Setup Utility".  To work around this issue, here are some  
> suggestions...
>
> a) You could use GUI scripting to simulate user interaction to  
> select the
> printer and type the number of copies into the print dialog.  For  
> example:
>
>
> tell application "System Events"
>    tell process "FileMaker Pro"
>        set frontmost to true
>        keystroke "p" using command down
>        repeat until window "Print" exists
>        end repeat
>        tell window "Print"
>            keystroke "20" -- number of copies
>            tell pop up button 3
>                click
>                tell menu 1
>                    click menu item "HP Laser" -- Your printer name
>                end tell
>            end tell
>            keystroke return -- depress the "Print" button
>        end tell
>    end tell
> end tell
>
>
> b) You could create a FileMaker script step that prints the layout  
> to PDF,
> and then have AppleScript take over, open the PDF in something,  
> such as
> Adobe Acrobat Professional, and print it X number of times from there.
>
> Hope this helps.
>
> -Ben
Richard S. Russell

Re: New Window Issues - Windows XP

Reply Threaded More More options
Print post
Permalink
In reply to this post by Hans Gunnarsson
Some javascript/style in this post has been disabled (why?)

On 2007 Aug 31, at 7:07, Hans Gunnarsson wrote:

But you normally get the same functions by pressing the control key before entering a keyboard shortcut when working on Windows. You even have Ctrl-Q to quit the application.


Oh, yeah, that's one other difference that cross-platform application-program creators have to deal with. Do you QUIT the program (Mac) or EXIT it (Windows)? Is it more important to be consistent from one version of your PROGRAM to the other, or to be consistent with what other users of that OPERATING SYSTEM are expecting? (This is evidently a thot that never occurred to the developers of Internet Explorer, who went with "Close", a command that everyone else in the known universe uses to close windows or files, not stop running a program.)
Hans Gunnarsson

Re: New Window Issues - Windows XP

Reply Threaded More More options
Print post
Permalink
Oh, yeah   ;-)

Normally I would say being consistent on a platform would rank higher  
but as everything when it comes to development is debatable....  -  
Who knows.

I know that my clients expect me to adhere to each platforms specific  
behaviors.

But then again you mention windows and there are so many  
"stupidities" in that platforms interface that you could probably  
write more than one book about it.

Kind regards
Hans


On 31.8.2007, at 16:56, Richard S. Russell wrote:

>
> On 2007 Aug 31, at 7:07, Hans Gunnarsson wrote:
>
>> But you normally get the same functions by pressing the control  
>> key before entering a keyboard shortcut when working on Windows.  
>> You even have Ctrl-Q to quit the application.

However these differences seem to come rather easy to users of the  
respective platforms.

> Oh, yeah, that's one other difference that cross-platform  
> application-program creators have to deal with. Do you QUIT the  
> program (Mac) or EXIT it (Windows)? Is it more important to be  
> consistent from one version of your PROGRAM to the other, or to be  
> consistent with what other users of that OPERATING SYSTEM are  
> expecting? (This is evidently a thot that never occurred to the  
> developers of Internet Explorer, who went with "Close", a command  
> that everyone else in the known universe uses to close windows or  
> files, not stop running a program.)
Tim Mansour

Re: Script Printing with Dynamic # of Copies

Reply Threaded More More options
Print post
Permalink
In reply to this post by Neil Ticktin-2
On 31/08/2007, at 11:58 pm, Neil Ticktin wrote:

> They are the same for each "location"
>
>> ... can you "pre-save" a PDF when the flier
>> changes rather than re-generating them every output?
>
> The generation is not the problem -- it's just that FileMaker won't  
> let me
> print the quantities that I want.

Yep, understood Neil. But my suggestion was that you could generate a  
PDF flyer once (for each location) and store it somewhere, then use  
an AppleScript to print copies of it when required (ie, the  
AppleScript being run from a script within FileMaker).

--
Tim Mansour <[hidden email]>
Neil Ticktin-2

Re: Script Printing with Dynamic # of Copies

Reply Threaded More More options
Print post
Permalink
At 10:49 AM +1000 9/1/07, Tim Mansour wrote:

>On 31/08/2007, at 11:58 pm, Neil Ticktin wrote:
>
>> They are the same for each "location"
>>
>>> ... can you "pre-save" a PDF when the flier
>>> changes rather than re-generating them every output?
>>
>> The generation is not the problem -- it's just that FileMaker won't
>> let me
>> print the quantities that I want.
>
>Yep, understood Neil. But my suggestion was that you could generate a
>PDF flyer once (for each location) and store it somewhere, then use
>an AppleScript to print copies of it when required (ie, the
>AppleScript being run from a script within FileMaker).

Yep ... the problem is that the quantities change from month to month ...
and the bottleneck is not producing the print job, it is the print job
going over the Internet to the office.

In the end, the band aid of using AppleScript to control FileMaker from
outside of FileMaker and through the GUI is the solution.  Funny part is,
the AppleScript executed from within a FileMaker ScriptMaker script doesn't
work.

Thanks!

Neil
Data531

Send Mail - Microsoft Outlook and Entourage

Reply Threaded More More options
Print post
Permalink
In reply to this post by Richard S. Russell
Hello

When using the Send Mail script the Microsoft email apps Outlook and  
Entourage will not automatically add the persons default signature.

Is there a trick to force both these email packages to automatically  
add/append the persons default signature when prompted to by a Send  
Mail script step?

Thanks in advance.

David
Australia.
Data531

Open URL - Adding An Attachment

Reply Threaded More More options
Print post
Permalink
In reply to this post by Richard S. Russell
Hello

When using the Open URL script step to format an email via the mailto  
command is it possible to add an attachment to the resulting email  
the same way the Send Mail script step works?

Thanks in advance.

David
Australia.
Beatrix Willius

Re: Send Mail - Microsoft Outlook and Entourage

Reply Threaded More More options
Print post
Permalink
In reply to this post by Data531
It's easy to create an AppleScript for a new mail:

tell application "Microsoft Entourage"
        make new draft window with properties {subject:"test",  
content:"theBody"}
end tell

But the syntax for the signature eludes me.

Class signature: A signature
Plural form:
        signatures
Properties:
        name Unicode text  -- the name of the signature
        ID integer  [r/o]  -- the signature's unique ID
        content Unicode text  -- the text of the signature
        include in random boolean  -- is the signature included in the  
random list?

I don't know how to connect the window with the signature. But you  
could get the signatures and set the required one directly with the  
body of the message.

HTH


Am 04.09.2007 um 17:27 schrieb David J Horne:

> Hello
>
> When using the Send Mail script the Microsoft email apps Outlook  
> and Entourage will not automatically add the persons default  
> signature.
>
> Is there a trick to force both these email packages to  
> automatically add/append the persons default signature when  
> prompted to by a Send Mail script step?
>
> Thanks in advance.
>
> David
> Australia.





Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: archive, clean and search email
http://www.beatrixwillius.de
Fractals, 3d landscapes etc.
Fenton Jones

Re: Send Mail - Microsoft Outlook and Entourage

Reply Threaded More More options
Print post
Permalink
On Sep 4, 2007, at 10:17 AM, Beatrix Willius wrote:

> I don't know how to connect the window with the signature. But you  
> could get the signatures and set the required one directly with the  
> body of the message.

I no longer have Entourage on this machine, but I've found that  
Entourage and Mail have very similar AppleScript implementations.

I believe the signature is merely added as another paragraph at the  
end of the content. I had to get the signature before entering the  
tell message block, as the signature object belongs to the  
application itself, not the message. Entourage may differ somewhat,  
but is likely much the same.


set theSubject to "test"
set theMessage to "Test of Signature"
set theRecipient to "[hidden email]"
set theSender to "[hidden email]"

tell application "Mail"
        activate
        set sig to signature named "Fenton Jones Consulting"
        set newMessage to make new outgoing message with properties  
{subject:theSubject, content:theMessage}
        tell newMessage
                set sender to theSender
                make new to recipient at end of to recipients with properties  
{address:theRecipient}
                set content to content & return & return & content of sig
                --save newMessage
                send newMessage
        end tell
end tell
1 2