Re: sending data from one AppleScript App to another
Re: sending data from one AppleScript App to another
- Subject: Re: sending data from one AppleScript App to another
- From: Michael Glasser <email@hidden>
- Date: Fri, 5 Sep 2003 01:14:00 -0700
This sounds like it is getting close to my needs.
Here is a full list of my needs:
1) AIM Script has to create / write to the file -- you covered this
2) Bot Script has to read from the file -- you covered this (well, can
I read just the first few lines?)
3) Bot Script has to erase ONLY what it has read. This may be just the
1st 4 lines of a 400 line (or longer) file -- any ideas?
I *can* have the Bot Script read the whole file and then write back
what needs to be written back, but wouldn't that slow things down?
What happens if the AIM Script is writing to it at the same time?
Also, is there a quick way to know the number of lines the file has.
Thanks for the help... really appreciate it.
Make your buffer a text file - not a TextEdit document. Writing to and
reading from text files with the write and read Standard Additions is
tremendously fast. You can set the location of the file so that it
will work
for everyone. For example:
set appSupportPath to path to application support from user domain
as
Unicode text
try
set myAppSupportFolder to alias (appSupportPath & "My App
Name:")
on error -- first time
tell application "Finder" to set myAppSupportFolder to make new
folder at item appSupportPath with properties {name:"My App Name"}
end try
set myBufferFilePath to (myAppSupportFolder as Unicode text) & "My
App
Name Buffer.txt"
set fileRef to open for access file myBufferFilePath with write
permission -- makes it if first time
set eof fileRef to 0 -- only if rewriting every time
write "Whatever you're writing" to f starting at eof -- 'starting
at
eof' if continuing on
close access fileRef
If the other file just needs to read it, it can
set r to read alias myBufferFilePath
without even opening for access. If it needs to read, add some more
text,
then write back to teh file, then after pening for access with write
permission in the script above:
set r to read fileRef
Then make your adjustments and write back, either after setting eof to
0
(rewrite completely), or starting at eof (continuing on).
_______________________________________________
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.