NSReceiverEvaluationScriptError: 4 (1) ?

Hello,

I’m sorry if this has been covered before, or if this isn’t the proper place to ask this, but I couldn’t find anything on these forums or on the web that answered my question.

Basically, every Applescript studio app that I open gives me a a dialog saying “NSReceiverEvaluationScriptError: 4 (1)”. Sometimes it pops up right away and the the applications main window never shows up, or sometimes it happens when I push a button. All of these apps used to work fine for me, but now they’re all a pain to use (some I can’t use at all since the app window never appears…).

In my search for an answer I found that a.) it might have something to do with Enabling Access for assistive devices, this is already enabled however, and other (non AppleScript) apps are accessing it fine, or b.) that something changed in the way applescript reports errors, so what was before a silent error now pops up a NSEvaluation error. That might mean that the problem is on the developers’ end, but I kinda doubt that, because, like I said, every Applescript App that I’ve tried has popped up this message…

Does anyone have any ideas about what might be happening? Any help would be nice.

Thanks.

NSReceiverEvaluationScriptError is a constant that refers to a mis-referenced object somewhere. For example, if you’re trying to talk to an NSTextField named “textField”, but you’re mistakenly calling it “myTextField”. Another common mistake is to mis-reference the container hierarchy of an object:

set contents of text field "textField" of window "main" to "foo"

But it happens to be inside a box, so it really should be:

set contents of text field "textField" of box "someBox" of window "main" to "foo"

You may want to add some breakpoints and run your apps through the debugger if they’re particularly complex. That will help you find where it’s happening.

Question: Does this happen on apps you didn’t make? I.e., are you having probems running apps that should work normally that you got from somewhere on the Internet?If so, can you give us some examples and URLs?

Yeah, this is happening in apps I didn’t make.

Examples are:
Pause: http://macupdate.com/info.php/id/17461
It takes a couple seconds for the NSEvaluation error to pop up but eventually it does and then periodically it will pop up again. It also appears when I click the “More Options” button.

MoaTunes: http://www.macupdate.com/info.php/id/8533

The dialog pops up right away, and then again after I press the Ok button. The main window never appears.

Xupport: http://www.macupdate.com/info.php/id/9256

Same as Moatunes.

iWake: http://www.macupdate.com/info.php/id/18620

Two dialogs pop up right away, then a third. One also appears when I close the main window, and when I quit.

Like I said I used to be able to use all these apps without a hitch. I’m not quite sure when this problem started since I don’t really use any of these apps all that frequently. I think the first app I noticed in was MoaTunes, but at the time I just passed it off as MoaTunes being weird, because it had a tendency to do odd things… Then today, another app popped up that message, and I thought “Hey… I’ve seen that before…” and decided to check all my other applescript programs.

Thanks again.

Weird. A few questions:

  1. What version of Mac OS X are you running?

  2. Does this happen with clean (new) test user accounts?

  3. (This is going to sound stupid, but . . .) Have you restarted since this problem began?

I’m running 10.4.6. And yeah, restarting was the first thing I tried…

The apps do run fine in a test account though, so it must be something I did to my account… Hopefully, I can narrow down what’s causing the problem.

Thanks again for the help.

Edit: Okay, I found out what was causing the problem. It was a SIMBL plugin for making windows fullscreen (megazoomer: http://macupdate.com/info.php/id/21275) and it looks like other people were having the same problem. Phew! I’m glad that problem’s over!

Well, I found this thread by copying the error message and doing a Google search on it.

When I run the “Save Safari Web Archive” script which I found on this message board, this message does NOT come up. But when I add the statement

repeat while (window 1 of application “Safari” is not null)

at the beginning and also add the statement

end repeat

after the script (but before the final “to” loop), the script saves multiple open windows instead of just one, which is the purpose in making this change, but then the error message pops up.

I noticed that the error also pops up if I attempt to run the script (either the original or my modified version) without any window open in Safari.

Model: PowerBook G5 1.5 GHz
AppleScript: 1.10.6
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)

We are trying to use the below code but it gives error “NSReceiverEvaluationScriptError: 4 (1)”

tell application "Adobe Acrobat Pro"

 

            activate

 

            open PdfFile

 

        end tell

 

        tell application "System Events"

 

            tell application process "Acrobat"

 

                click the menu item "PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of the menu "File" of menu bar 1

 

                keystroke "/"

 

                keystroke keyString & onlyFileName

 

                keystroke "

 

        "

 

                keystroke "

 
        "

 
            end tell

 
        end tell

It give a problem on click the menu item. This code is working fine on my own laptop but it doesn’t work on user system. All the configuration of OS and application version are identical.