Re: Strange problem
Re: Strange problem
- Subject: Re: Strange problem
- From: Graff <email@hidden>
- Date: Fri, 30 Jul 2004 16:03:10 -0400
It sounds like the saved properties got corrupted somehow and got set
to something that didn't work at all. So you were doing the set in the
try...end try statement, it was failing and falling over to the error
statement, which was failing. Thus the variable fontList was never
getting defined. When you pre-defined the fontList then the variable
was defined and all was well.
At least that is how it looks, I could be wrong.
To really be bulletproof you might want to bracket everything with one
more try statement that clears the properties in case they are corrupt:
----
property pClientName : "FavFontsPalette" --User pref client identifier.
property pFontListID : "FontList" --Font list user pref ID.
property pDefaultFonts : {"Helvetica Regular", "Times Regular"}
on run
try
tell application "MultiAd Creator Pro"
try
set fontList to (get user preference from client pClientName with
ID pFontListID)
on error err
set fontList to pDefaultFonts
end try
if fontList is {} then
set fontList to pDefaultFonts
end if
end tell
on error
-- perhaps the properties are corrupted
-- reset them to defaults to be sure
set pClientName to"FavFontsPalette"
set pFontListID to "FontList"
set pDefaultFonts to {"Helvetica Regular", "Times Regular"}
end try
end run
- Ken
On Jul 30, 2004, at 9:25 AM, Steve Mills wrote:
One of the scripts we ship with our app wasn't working on ONE of our
tech support person's OS9 machine. Here is the part in question:
property pClientName : "FavFontsPalette" --User pref client identifier.
property pFontListID : "FontList" --Font list user pref ID.
property pDefaultFonts : {"Helvetica Regular", "Times Regular"}
on run
tell application "MultiAd Creator Pro"
try
set fontList to (get user preference from client pClientName with
ID pFontListID)
on error err
set fontList to pDefaultFonts
end try
if fontList is {} then
set fontList to pDefaultFonts
end if
end tell
end run
When she ran it, it returned an error on the "if fontList is {} then"
line, saying that fontList wasn't defined. After having her try many
things, what ended up working was the addition of the line "local
fontList" at the top of the run handler. Does anybody see a reason why
it would NOT work on one OS9 machine, and why that would fix it?
Also strange; when I compiled the script in Script Debugger with
debugging turned on, it complained that there was code outside the run
handler. There isn't, except for the property definitions, and I'm
sure that is legal to have outside a run handler. Ain't it?
_______________________________________________
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.