Re: Cocoa Loco
Re: Cocoa Loco
- Subject: Re: Cocoa Loco
- From: "John C. Welch" <email@hidden>
- Date: Sun, 02 Mar 2003 08:58:55 -0500
On 03/02/2003 07:50, "John Delacour" <email@hidden> wrote:
>
My problem with this is that there seem to be two Applescripts -- on
>
the one the Applescript that other people and, occasionally in the
>
past (cf. Scriptable Text Editor, WorldText, Claris Emailer) Apple
>
have developed and implemented and on the other a stange perversion
>
of this now being developed and implemented by people with no
>
apparent knowledge or respect for the language as we have known it.
>
>
It is difficult for me to be "contructive" other than to suggest that
>
those currently charged with Applescript deconstruction get their act
>
together.
As much as it may shock folks...I have to agree with John here...it's not
just the language either...Apple's dev tools are really useless in too many
ways.
For example...at some point, I set up Script Debugger to be the debugger for
AppleScript Studio.
Why?
Well, evidently, Apple thinks that scripters don't need debuggers.
(Well, that's not true, but it's the impression given by not having
functional debugging tools in Studio.)
But even little things, things like reading line endings...Script Debugger
can, but evidently there isn't a Cocoa tool on the planet that manages this.
For example, in the following code:
property theNumberOfEthernetInterfaces : 0
property theInterfaceCountList : {}
property oldDelims : ""
property theInterfaceCountScript : "ifconfig | grep \"en[0-9]:\""
property theInterfaceCountScriptResult : ""
property theInterfaceNumber : ""
property theIntefaceMenuItem : ""
set theInterfaceCountScriptResult to do shell script theInterfaceCountScript
with altering line endings --get the number of EN interfaces on a system
display dialog theInterfaceCountScriptResult
set oldDelims to AppleScript's text item delimiters --save the original
delimiters
if oldDelims "" then
set oldDelims to "" --just in case they were incorrect
end if
set AppleScript's text item delimiters to "
" --set line break char as a delim. This forces every line into a list item
set theInterfaceCountList to (every text item of
theInterfaceCountScriptResult) --this creates a list, with one entry per
line in the grep result
set theNumberOfEthernetInterfaces to the length of theInterfaceCountList
--the number of entries in the list == number of ethernet interfaces
display dialog theNumberOfEthernetInterfaces
I get results for every ethernet interface on my system. On my TiBook, this
is 2. I know it's two. Script Debugger runs this code, and tells me I have
2.
Script Editor 2 and Project builder tell me I have one. (this is consistent
no matter how I set line endings from the 'do shell script' step.
Now, normally, i'd file a bug. But why? I *know* what the answer will be:
(sing it with me brothers)
"When it's fixed in Cocoa, it will be fixed in <application>"
And can anyone guess what the priority of AppleScript is amongst the Cocoa
people and NeXTies at Apple? Why, just as a hazardous guess, right up there
with scraping gum off of the ground to save on janitorial costs.
So not only is Cocoa scripting *seriously* problematic, but there's no real
point in telling anyone, because all fingers get pointed to the friggin'
frameworks. Which is really silly, as I thought one of the things you can do
with OOP is override some object to add features or fix deficiencies. Oh
well, silly me.
AppleScript for Carbon apps rocks. AppleScript in Cocoa is *broken*, and no
amount of PR spin, or tenacious defending is going to change that fact.
Quite honestly, for anything beyond the simplest scripting, IMO you'd have
to be a bit mad to use Cocoa apps.
john
--
Some days, you just have to pimp -slap people with the hard, cold glove of
reality.
john c welch
--
"Those who would give up essential liberty to purchase a little temporary
safety deserve neither liberty nor safety."
--Benjamin Franklin, 1759
_______________________________________________
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.