• 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
Filemaker to text as rtf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Filemaker to text as rtf


  • Subject: Filemaker to text as rtf
  • From: Gregory White <email@hidden>
  • Date: Mon, 30 Jul 2007 15:25:37 +1000

Hello,  Malcolm,

What I wish to do is end up with a rtf file which contains the formatting that is in the filemaker field.

Greg

Here again the script as it stands.

========================

tell application "Finder"
set homeFolder to (home)
set D_folder to folder "Documents" of homeFolder
end tell

tell application "Finder"
if not (exists folder "ReferenceWorks Bookmaker" of D_folder) then
make new folder at D_folder with properties {name:"ReferenceWorks Bookmaker"}
end if


end tell

tell application "FileMaker Pro Advanced"
set {fileName, this_Book} to {get data of cell "FileName" of current record, get data of cell "CompleteBook_cc" of current record}
end tell

set homeFolder to path to home folder as Unicode text
set BookmakerFolder to homeFolder & "Documents:ReferenceWorks Bookmaker:"
set this_file to BookmakerFolder & fileName & ".rft"
my write_to_file(this_Book, this_file, false)


on write_to_file(this_data, this_file, append_data)
-- I don't understand the var this_data, where is it declared?


-- it is declared in  the opening line of the subroutine,
-- on write_to_file(this_data, this_file, append_data)
-- it is defined somewhere outside the subroutine
-- and it is passed to the subroutine like this:
-- my write_to_file(this_Book, this_file, false)
-- so, in this example this_Book contains a value (which we obtained from FMP )
-- and it is being passed to write_to_file() as the first parameter which is named this_data


-- why doesn't my script work?
-- when FMP sees "write" it thinks it knows what that means.
-- however FMP 's "write" is a property of objects, like fields, layouts and tables.
-- it has to do with user privileges: "write" means the object can be modified by the current user.
-- In FMP you would make an assertion, eg, "access of cell 2 of layout 1 is write"
-- which would be true or false
-- BECAUSE THIS ROUTINE IS BEING CALLED WITHIN FMP
-- WE HAVE TO CALL THE STANDARD ADDITIONS WRITE COMMAND USING RAW CODE
--  THE STANDARD ADDITIONS "WRITE" COMMAND IS «event rdwrwrit»
--  THE STANDARD ADDITIONS "READ" COMMAND IS «event rdwrread»
-- I keep a copy of  the raw code "protected" by comments
-- in any script dealing with FMP because the AppleScript decompiler always
-- replaces «event rdwrwrit» with the word write
-- and every time that happens we have to replace the word write with the raw code «event rdwrwrit»
-- so that FMP doesn't get confused!


try
set the target_file to the this_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
«event rdwrwrit» this_data to the open_target_file starting at eof -- call "write" using raw code: «event rdwrwrit»
close access the open_target_file
return true
on error errMsg number errnum
display dialog errMsg & return & errnum
try
close access file target_file
end try
return false
end try
end write_to_file


Gregory White, 
Homeopath, M.A.H.A., Reg. AROH.
Australian & NZ Dealer for Kent Homeopathic Associates
---------------------------------
Mullumbimby (Near Byron Bay), Australia
Phone: +61 (0)2 6684 5557
Email: email@hidden
Skypename: repertory.org
Websites: http://www.repertory.org.
http://www.kenthomeopathic.com



 _______________________________________________
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: GUI Scripting to toggle "Announce Time"?
  • Next by Date: Re: AppleScript and shell scripting
  • Previous by thread: Fw: Network volume considerations when working with files?
  • Next by thread: Re: AppleScript-Users Digest, Vol 4, Issue 357
  • Index(es):
    • Date
    • Thread