Re: Filemaker 8.5 stored applescript problem
Re: Filemaker 8.5 stored applescript problem
- Subject: Re: Filemaker 8.5 stored applescript problem
- From: David Simerly <email@hidden>
- Date: Thu, 17 May 2007 01:22:40 -0700
- Thread-topic: Filemaker 8.5 stored applescript problem
- Url: http://www.digital-native.com
Title: Re: Filemaker 8.5 stored applescript problem
On 5/14/07 2:58 PM, "Stockly, Ed" <email@hidden> wrote:
Ok, so I did just that and indeed found: numerous "read" and "write"
commands in the filemaker dictionary.
I think what you probably found are the “read” and “write” constants for the “access” enumeration, as in:
every cell whose access is read/write
There are no “read” or “write” commands in FM’s dictionary.
On 5/14/07 2:03 PM, "James Nierodzik" <email@hidden> wrote:
Like you guessed you *can* read it actually, but it can choke the
script up, but anything under a few megs and you should be fine.
On May 14, 2007, at 3:48 PM, deivy petrescu wrote:
>
> On May 14, 2007, at 16:23, James Nierodzik wrote:
>
>> Actually the portion about opening for access is quite untrue. If
>> you only intend to read from a file there is no need to read from
>> it unless it is very very large.
>
> James,
> where did you get this information? I've never heard that you can
> not read it if it is very large.
> Unless you mean that reading it by bits will not choke the script.
I think the caveats in your advice support the use of “open for access.” In my experience I’ve found that using OFA before calling read/write usually helps avoid unexpected errors. I believe that this is the reason OFA is used in all the read/write examples in the AppleScript Standard Additions Guide (page 71-84, http://tinyurl.com/2whgk5). Note that in addition to creating a file for you if one doesn’t already exist, OFA also returns a “file reference number,” or what I call a “file pointer,” which provides faster I/O when used instead of a file reference or alias. So really, there are more advantages for using OFA than not. I’d say that if you’re writing scripts that don’t use OFA, then you’re scripting potential landmines.
On 5/14/07 4:37 PM, "Malcolm Fitzgerald" <email@hidden> wrote:
David, if you open FMP dictionary and search for read or write you'll
find read and write affects cells, fields, records, layouts and tables.
The entries for each of those objects have read and write described.
Yes, but again, those are not “commands” -- they are not executable. There are no read/write commands in FileMaker.
Granted, there is a problem executing Standard Additions read/write commands from a ScriptMaker “Perform AppleScript” step, but it’s not a terminology conflict. If a command were able to conflict with the name of another AS object type (class, property, enumeration, constant, and so on), then the language just wouldn’t work. As an example, look at the “everyones privileges” property of the Finder’s “item” class; it also has read/write constants, but the Standard Additions read/write commands work in Finder with no problems — because those are constants of a property, not commands.
Only FMI engineering can tell us for sure why this problem occurs, but my guess is that it’s more likely a conflict with the application’s own I/O handling. A work around to the problem is this:
using terms from application "System Events"
set file_path to "/var/tmp/myNewFile.txt"
set file_ptr to open for access ((POSIX file file_path) as reference) with write permission
write file_path to file_ptr
close access file_ptr
end using terms from
Just trying to help.
Dave
_______________________________________________
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