FaceSpan in general - What's not in the manual
FaceSpan in general - What's not in the manual
- Subject: FaceSpan in general - What's not in the manual
- From: macgix <email@hidden>
- Date: Thu, 11 Oct 2001 08:00:26 +0200
This is some info all FS users should know and respect.
It's not FaceSpan, that's wrong. It's the way we deal with it.
This is from Shirley from DTI and did help me a lot. So it will do it for you too!
----------------------------------
Now we are getting somewhere. You have narrowed down where the problem is.
The problem looks as if it has to do with storage items in FaceSpan.
Storage items are one feature that FaceSpan has that no other similar
application has (and sometimes I wish it didn't because it is probably the
most misunderstood). I can't guarantee the following will solve your
problem, but I am quite sure it will help (at least with stability issues
over the longhaul).
Two rules in using FaceSpan:
1. Do not use the MY reference unless you are in a tell statement to
another application (or you want to reference a property at the next level
down in FaceSpan's window item > window > application hierarchy. You have
at least six instances in the code below where you are using the MY
reference. This is not in a tell statement, so may I ask why you are using
it? There are versions of AppleScript when paired with FaceSpan that just
will not allow this error to "slide".
2. Storage items. (a) Only use storage items for repositories of
information that does not change.
Yes, you can use storage items as suggested by Schettino etal in
"AppleScript Applications" but the application is bound for trouble. When a
FaceSpan project is saved as an application the storage items become
resources of the application (stored in the resource fork).
(b) Always use a variable in working with a storage item, do not access
storage items directly. In your code below you have:
set storage item "tCount" to round of ((count of (MakeListFromText tText
UsingDelimeters {return})))
instead use:
set myList to (MakeListFromText tText UsingDelimeters {return})
set xCount to count of myList
set storage item to xCount
Not only are you accessing the storage item directly, you are nesting
handler calls in the statement.Storage items are a "different" animal than
you are probably used to working with in AppleScript.
I also would wonder about the statement:
set Project to storage item "pro_ject"
I can't get it to fail in any of my tests (System 9.1), but you could have
a problem with the storage item not properly deferencing in some other
versions.
Another example in your code below:
if storage item "tCount" is false then
....
instead use:
set theBoolean to storage item "tCount"
if theBoolean is false then
....
And again,
set storage item "stopper" to true
instead use:
set theBool to true
set storage item "stopper" to theBool
The problem is one of dereferencing. (You might find out that in the
version of the Mac OS that is giving you problems, that the real value of
tRef in the line
set tText to read tRef
is a reference (pointer) to the value stored in the storage item, not the
actual string value, as the version of AppleScript did not properly
dereference the variable. For this reason AppleScript's open access command
does not see file Project as a file object, therefore it errors out. Adding
the words "contents of" should help (set Project to contents of storage
item "pro_ject"), but to be safe it is best to not use the storage item for
this purpose at all. (Why not a property?)
One of the reasons that I fought so hard to get the preference items (pref
file info) into FaceSpan (version 3.1+) was to get people to quit using
storage items for volatile storage. Storage items work great for holding
scripts and script objects, for default preference values, etc. but not as
a database. If you do use storage items for storing volatile information
make sure that you place the information into a variable before trying to
use the value.
Apparently you do have the IMac at your disposal. You might try putting the
actual string value for the file path in the open for access statement and
see if the application still fails at that point; or if it goes on to fail
at the code where you are setting the storage items (nine lines later). If
you are using the storage items just to test to see what is happening in
your application, use a text box in a window instead. Using the Any2Str
osax, you can plunk the value of any variable into a textbox in that window
and see exactly what its value is. (Noticed that you removed the Any2Str
osax from your project so you are probably very familiar with using it.)
Here is the piece of code, that stops at the "####"-mark:
on checkTable()
activate
try
get window "Log"
on error
open window "Log" with properties {position:centered
in main}
try
set visible of gauge "progress" of window
"Log" to false
end try
my InitDelimTable()
end try
my setVisibleOfGauge(false, "progress")
my displayStatPos("Bitte haben Sie ein wenig Geduld?")
my displayWordProcessed("")
copy "Checking entries in the caonverterdefinition" to textbox
"lab" of window "Log"
set Project to storage item "pro_ject"
set tRef to open for access file Project
try
####set tText to read tRef
close access tRef
on error errtext number errnum
close access tRef
error (errtext & " / " & errnum)
end try
-- (#### if i removed the try-block nothing changed!)
-- (#### if i used AKUA "read data from" nothing changed!)
try
set storage item "tCount" to round of ((count of
(MakeListFromText tText UsingDelimeters {return})))
on error
set storage item "tCount" to my
countReturnsInText(tText)
end try
if storage item "tCount" is false then
return false
else
my displayWordProcessed("")
set storage item "stopper" to true
return true
end if
end checkTable
--------------------------------
"Let's script the world to make it better"
Thomas
_______________________________________________________________________
Thomas Johannes Matthias Kuehner
Developer, Supervisor, Manager
<email@hidden>
<www.macgix.com>
_______________________________________________________________________
If you'd want to send encrypted mail to me, you will use PGP 5 or later
and this address: <email@hidden> - Thank you.
_______________________________________________________________________