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

Re: Appleworks.


  • Subject: Re: Appleworks.
  • From: Malcolm Fitzgerald <email@hidden>
  • Date: Thu, 21 Oct 2004 13:00:23 +1000

This from Bruce Robertson - dated 19/10/04 9·21 pm:


Hm, what is the point of this? If it's still a text document it's still a
text document. You could just change the creator code if that's all you want
to do.


... and this from Malcolm Fitzgerald - dated 20/10/04 1·01 am:


However, if you are saving as text you hardly need to bother with
Appleworks. You may use standard additions to read and write text files.


Mr Tea wrote:

Well now, if Ruby needs to use Appleworks, then let it be. I know it's not
very fashionable at the moment, but it's been around (and scriptable) for a
long time.... :-)

I regard the suggestions of both Bruce and I as analogous to "Don't put commands within a tell block unless it is necessary". You may get good results from AppleWorks but is unreliable in my experience.


In this example I use AppleWorks and standard additions to complete a task quickly and cleanly. It generates a simple file of text. It is 410 characters long.

-------- example one
tell application "AppleWorks 6"
	tell document 1
		copy it's text to s -- use this shortly
		copy it's name to docName
		close it saving no
	end tell
end tell

set docPath to path to documents folder from user domain as Unicode text
set fileName to docPath & docName & ".txt"
set fileRef to (open for access file fileName with write permission)
write s to fileRef
close access fileRef
----------

In this example I use AppleWorks to generate the text file and AppleWorks. On the first attempt it crashed. I ended up with an empty file in my documents folder. On the second attempt it succeeded. However, it is not a simple file containing the text of the document. It is an AppleWorks file saved in text format. Opening it in Text Edit reveals a huge amount of junk, including an extensive pList. It is 22904 characters long.

It really depends on what Ruby wants the file for. When opened by AppleWorks it is not visible. The crash does undermine my confidence.

-------- example two

tell application "AppleWorks 6"
	tell document 1
		copy it's name to docName
	end tell
end tell

set docPath to path to documents folder from user domain as Unicode text
set fileName to docPath & docName & ".txt"

tell application "AppleWorks 6"
	tell document 1
		save it in alias filename as file type TEXT
		close it saving no
	end tell
end tell
--------

--
Malcolm Fitzgerald                        phone: 02 9318 0877
Database Manager                            fax: 02 9318 0530
The Australian Society of Authors         <http://www.asauthors.org>

_______________________________________________
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


References: 
 >Re: Appleworks. (From: Mr Tea <email@hidden>)

  • Prev by Date: Re: Script to Cycle Through Apps?
  • Next by Date: writing and reading list vars to text file
  • Previous by thread: Re: Appleworks.
  • Next by thread: RE: Appleworks.
  • Index(es):
    • Date
    • Thread