• 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
Rép: Scripts or example scripts for Pages?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rép: Scripts or example scripts for Pages?


  • Subject: Rép: Scripts or example scripts for Pages?
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 27 Feb 2009 17:48:13 +0100

Le 27 févr. 2009 à 01:36:24, M Pulis a écrit :

I am looking for scripting example for Pages. My objective is a mail-merge function. Trying to read the pages dictionary and getting a bit lost as to implementing this properly.


As it may be useful for other here is a way to launch a merge task.

It's a bare script which assumes that the Pages document is ready and is the frontmost one.

--[SCRIPT]
tell application "Pages" to activate
tell application "System Events" to tell (first process whose title is "Pages")
tell menu bar 1 to tell menu bar item 4 to tell menu 1
--get name of menu items -- useful to get the index of the menu tem to click
click menu item 20
end tell
set ready to false
if 4 ≤ (system attribute "sysv") mod 4096 div 16 then
repeat 5 times
try
get name of sheet 1 of window 1
set ready to true
exit repeat
end try
delay 0.1
end repeat
else
set cw to count of windows
repeat 5 times
if (count of windows) > cw then
set ready to true
exit repeat
end if
delay 0.1
end repeat
end if
if ready then
keystroke return
else
error "The document is unable to Merge !"
end if
end tell
--[/SCRIPT]


It was tested under 10.4.11.

If I remember well, under 10.5.x, the Merge dialog
is not in a sheet of the document's window
but is in a true window.
This is why there is a simple test upon the operating system.

Yvan KOENIG (from FRANCE vendredi 27 février 2009 17:36:20)




_______________________________________________ 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: using a shell variable in an osascript line?
  • Next by Date: Re: AS + MS Word 2008 and vertical alignment in table cells
  • Previous by thread: Re: AS + MS Word 2008 and vertical alignment in table cells
  • Next by thread: Sturm, Lewis is out of the office.
  • Index(es):
    • Date
    • Thread