Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Applescript > Problem using p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 22 Topic 1620 of 1674
Post > Topic >>

Problem using property to save a files name or alias

by fergus@[EMAIL PROTECTED] Jun 9, 2008 at 02:57 PM

Below is my appleworks applescript macro to automatically print
envelopes.
A rewrite of a AW5 macro that was extremely popular with my users.
However,
despite Iots of fiddling I cant get the PROPERTY bitty to work. It
either
always prompts for the template or never prompts and errors.

Is anybody able to tell me what is going wrong in the first if
statement?
Also what is best practice for writing AW 6 macros, do I still need
the
"tell application" and "activate" if I cam being called from within
AW? Any
other pointers or suggestions gratefully accepted.

  property envelopedoc : ""
  if envelopedoc is equal to "" or not (exists file envelopedoc) then
    set envelopedoc to choose file with prompt "Please select the
envelope template to use"
  end if

  tell application "AppleWorks 6.2.9"
    activate
    try
      set selectedText to selection of front do***ent
      if length of selectedText is less than 20 then
        say "Nothing worth printing"
        return
      end if
      set the clipboard to selectedText
      open envelopedoc
      set envelopename to name of front do***ent
      select do***ent envelopename
      paste
      select text of do***ent envelopename
      set font of selection to "Helvetica"
      set size of selection to 15
      print front do***ent with print dialog
      close do***ent envelopename without saving
    on error theerror
      close do***ent envelopename without saving
      display dialog theerror
      display dialog "Unable to print envelope."  \
          buttons {"OK"} default button "OK" with icon 0
    end try
  end tell

Regards Fergus.
 




 22 Posts in Topic:
Problem using property to save a files name or alias
fergus@[EMAIL PROTECTED]   2008-06-09 14:57:09 
Re: Problem using property to save a files name or alias
J. Stewart <cfnzrpu@[E  2008-06-09 18:57:15 
Private Message
   2008-06-09 16:11:53 
Private Message
   2008-06-10 08:14:43 
Private Message
   2008-06-10 08:34:03 
Private Message
   2008-06-10 16:04:03 
Private Message
   2008-06-10 20:57:46 
Private Message
   2008-06-11 07:36:40 
Private Message
   2008-06-11 09:11:31 
Private Message
   2008-06-11 16:40:13 
Private Message
   2008-06-11 10:07:02 
Private Message
   2008-06-11 16:35:04 
Private Message
   2008-06-11 23:32:48 
Private Message
   2008-06-13 17:05:47 
Private Message
   2008-06-14 01:24:55 
Private Message
   2008-06-13 19:08:22 
Private Message
   2008-06-11 07:52:31 
Private Message
   2008-06-11 10:09:25 
Private Message
   2008-06-10 04:18:43 
Private Message
   2008-06-09 16:12:34 
Re: Problem using property to save a files name or alias
fergus@[EMAIL PROTECTED]   2008-06-10 14:09:09 
Re: Problem using property to save a files name or alias
fergus@[EMAIL PROTECTED]   2008-06-10 14:23:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 15:42:16 CST 2008.