Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
iWork/Pages problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iWork/Pages problems

Hi folks,

I'm trying to put together a script to convert my many Appleworks
documents to iWork documents.

Starting off with WP documents which should of course become Pages
documents. If and when Numbers becomes scriptable I'll be able to have a
fork which handles Appleworks spreadsheets too, but that's for the future.

I've got a sunny day scenario working, and even some rainy days, but
sometimes it doesn't rain but it pours.

I've discovered that Pages chokes on Appleworks WP documents which are not
'new' enough. I guess that means they were created with ClarisWorks 5 or
older. Fair enough.

The 'manual' solution is to open these documents in Appleworks 6, make a
small change, save them, and *then* open them in Pages. (You can see why I
need a script).

Problem is, I can't see any way for my script to be able to tell whether a
.cwk document is new enough for pages to open it. Suggestions?

Another problem is that Pages throws an ugly error alert box even if
'open' is in a try... block; Example

set theFile to (choose file)
tell application "Pages"

		set f to open theFile
	on error msg number n
		display dialog msg default answer (n as string)
	end try

end tell

Point that snippet at an old clarisworks file, and even though it's in a
'try' block, Pages still throws up an import error alert. Any ideas for
getting around this? Do I have to use GUI scripting?

Oh, and to add insult to injury, I discovered that when scripting Pages,
'open' does not return a reference to the opened file.


Workaround is something like

set theFile to (choose file)

tell application "Pages"
	-- hack to find out if 'open' succeeded
	-- because Pages' 'open' does not return a reference

		set d to document 1
	on error msg number n
		set d to missing value
	end try

		set f to open theFile
	on error msg number n
		display dialog msg default answer (n as string)
	end try

	if (d is document 1) then
		-- open failed
		return false
	end if
end tell

How many times do we have to see this bug? It was in QuickTime Player too,
and since they fixed it, I naively assumed it wouldn't appear again in
Apple's own Cocoa-based software, but there it is.

Brennan Young

A pure description would include all the facts (i.e., all the effective differences) immanent in the phenomena to be described but would indicate no kind of connection among these phenomena that might make them more understandable.

- Gregory Bateson
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.