• 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: Write file command in Filemaker
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Write file command in Filemaker


  • Subject: Re: Write file command in Filemaker
  • From: Yvan KOENIG <email@hidden>
  • Date: Tue, 3 Oct 2006 16:00:44 +0200


Le 3 oct. 2006 à 14:59, Jay Louvion a écrit :

on WriteToFile(this_data, target_file, append_data)
try
set the target_file to the target_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
write this_data to the open_target_file starting at eof as «class
utf8» -- at this stage, when compiling in FM, I have to add "tell app
"System Events" or "Finder" to..." otherwise the "write" sounds off the
non-compilation alarm.
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try


Re-reading your last messages, I assumes that when launched from FileMaker, your script is unable to know which must execute the write command.

I don't know how one may force it to speak to "Standard Additions" but you may speak to "Finder" or "System Events" coding this way:

-1- tell application "Finder" to write this_data to the open_target_file as «class utf8» starting at eof


-2- on WriteToFile(this_data, target_file, append_data) using terms from application "Finder" (* or "System Events" *) try set the target_file to the target_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 write this_data to the open_target_file as «class utf8» starting at eof close access the open_target_file return true on error try close access file target_file end try return false end try end using terms from end WriteToFile

-3-
on WriteToFile(this_data, target_file, append_data)
 try
        set the target_file to the target_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

using terms from application "Finder" (* or "System Events" *)
write this_data to the open_target_file  as «class utf8» starting at eof
end using terms from

        close access the open_target_file
        return true
    on error
        try
            close access file target_file
        end try
        return false
    end try
end WriteToFile

But in version 3, I'm not sure of what it would do if write generates an error.

Yvan KOENIG _______________________________________________
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


  • Follow-Ups:
    • Re: Write file command in Filemaker
      • From: Philip Aker <email@hidden>
    • Re: Write file command in Filemaker
      • From: Jay Louvion <email@hidden>
References: 
 >Re: Write file command in Filemaker (From: Jay Louvion <email@hidden>)

  • Prev by Date: Re: Write file command in Filemaker
  • Next by Date: Re: Write file command in Filemaker
  • Previous by thread: Re: Write file command in Filemaker
  • Next by thread: Re: Write file command in Filemaker
  • Index(es):
    • Date
    • Thread