Display Dialog capability lost

Suddenly I have been unable to write or run scripts that contain the “display dialog” command. The result of any attempt gives me an error -10960 which seems to suggest (to this non-programmer) that I have lost a resource from the Carbon library. I’ve run permissions repairs, of course, but the problem persists.

I’d take any suggestions.

First suggestions: I assume you’ve restarted, so let’s look beyond that. Try using Disk Utility (Disk First Aid) and check for a) damage to the disk or b) file permissions that are messed up. Whatever you find, repair it. You’ll need to boot from your install CD to run Disk First Aid on your hard drive if you don’t have any other way of booting (the HD is your only drive).

If you have installed any software updates recently, you should always repair permissions afterward. There’s some glitch that gets permissions on critical files sometimes fouled up with software update.

hi ettor,

first: i haven’t ever heard of your error code. very strange. i’ve looked and can’t seem to find it on the web. however,

i did find a neat discussion about Apple Error codes here:

http://www.macosxhints.com/article.php?story=20030603220554690

and i’ve adapted the perl script (one of the last entries) so that you could run it graphically as an AppleScript. unfortunately, it does not give any info on your particular error, but i post it in case it will help someone else (NOTE: you must have the Apple Developer tools installed to use this script):


--findErr - a utility to search Apple Header files for Error codes.
-- you _MUST_ have the Developer tools from Apple installed for this to work.

-- first, define our perl script
set errCode to "#!/usr/bin/perl
use warnings;
use strict;

# variables:
my ($path,$file,$name,$desc,$errnum);

# set the path to the header file
$path = '/System/Library/Frameworks/'
.'CoreServices.framework/Versions/Current/Frameworks/'
.'CarbonCore.framework/Versions/Current/Headers/MacErrors.h';

# open it and search for each argument.
while($errnum=shift){
    open $file, '<', $path;
    while(<$file>){
        if (m/=\\s$errnum\\,/) {
            $name=$_;
            $name=~s/^\\s*(\\S*)\\s.*$/$1/;
            chomp $name;
            $desc=$_;
            $desc=~s:^.*?/\\*(.*)\\*/:$1:;
            chomp $desc;
            print \"$name ($errnum): $desc\", \"\\n\";
        }
    }
    close $file;
}

exit 0;"

-- make a directory to hold the perl script.  we'll be running it as a file,
-- which is my preference.
try
	do shell script "/bin/mkdir ~/.tmp"
end try

-- set a variable to the file we want to create
set theTmp to "~/.tmp/findErr"

-- write the perl script to the file
do shell script "/bin/echo " & quoted form of errCode & " > " & theTmp

-- give the file 'execution' perms
do shell script "/bin/chmod +x " & theTmp

-- use a variable to hold our question
set myErrMsg to "What is the Error Code you are looking for?"

-- ask the user for the error code they are looking for
set theErr to text returned of (display dialog myErrMsg default answer "")

-- try to find the error.  if we can't find it, we'll let the user know that
try
	set appleAns to (do shell script "/usr/bin/perl " & theTmp & space & theErr)
on error
	set appleAns to ""
end try

-- display the answer
if appleAns is "" then
	display dialog "This error " & theErr & " was not found"
else
	display dialog appleAns
end if

--clean up!
do shell script "/bin/rm -rf " & theTmp
do shell script "/bin/rm -rf ~/.tmp"

you can put multiple error codes in the window and get them all at once, just separate them by space. for example, enter: “-42 23 -69” (as explained in the original article) and you will get all 3 error codes in your dialog box.

finally: i reiterate what kevin said, but would also suggest that you try to run the code on another Mac before doing anything drastic (like reinstalling the OS). just make sure that the machine is the problem before you do a lot of work.

Ettor,

Another thought, while I’m at it. Try running a script that has a display dialog while you have the Console program running and see if it logs anything. If there is a file missing or something going wrong, it may be logged there.

Thanks to both of you. I threw that PowerBook into the lake in back of my house, but when I return home I’ll fish it out and give both suggestions a try then post back.

The -10960 error code, which I found somewhere after a lot of digging, says something like “Carbon Library nib file not found.” I’m not a programmer, so I really don’t know what this means. I can’t write a display dialog script using any editor, nor can I run a DD script.

I was hoping that I could re-install the Standard Additions osax file, but I guess it is not available as a stand-alone file?

OUCH. A nib file is the output of Interface Builder, part of Xcode. Nibs contain all the interface info for programs or OS elements, things like windows, menus, and in this case probably the dialog box you need.

I’d say that sounds like “reinstall Mac OS X”. You can do a reinstall that will save your user directory, I can’t remember the option you need to select, but I’d say that’s what’s needed here.

i think it’s called “archive and install”