Re: puzzled with script syntax error
Re: puzzled with script syntax error
- Subject: Re: puzzled with script syntax error
- From: has <email@hidden>
- Date: Fri, 28 Jun 2002 17:26:25 +0100
On Thu, 27 Jun 2002, Cornwall warned everybody that some senile old fool
had written:
>
>Sending osax messages to the Finder can cause its own problems (i.e. lots
>
>of opportunity for keyword clashes there). What about sending them direct
>
>to the AppleScript object instead?
>
>
>
> tell AppleScript
>
> --blah blah
>
> end tell
>
>
I couldn't make that work in FileMaker 4. I just tried it with FileMaker
>
5.5 and it fails there also.
DOH! The only time I post in weeks and I go make a complete fool of myself
once more. The above won't make an ounce of difference to the problem... as
I'd have realised if I'd spent more than a half-second thinking about it.
Grrr. Stupid language. Stupid compiler. Stupid ME.
OK, try this instead; a compile-time solution for a compile-time problem:
======================================================================
using terms from application "SimpleText" --[kludge!]
set fileRef to alias "YOUR FILEPATH HERE"
open for access fileRef
set _result to (read fileRef)
close access fileRef
end using terms from
======================================================================
To avoid the risk of _any_ keyword screwups at all I've made a point of
using a totally non-scriptable application with no dictionary of its own,
rather than the Finder (which carries its own opportunities for stuff to
clash and generally go wrong).
I'm going to go hide myself in shame now...
has [forgetting to engage brain before operating mouth]
--
p.s. When the keyword conflict's caused by a 'tell application' block, the
best solution may be to spin this sort of code off into its own handler; eg:
on readFile(fileAlias)
open for access fileAlias returning fileRefNum
set fileContent to read fileRefNum
close access fileRefNum
return fileContent
end readFile
and then call it using:
my readFile(fileAlias)
--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.