Mac OS X Document Based Application: Open AppleScript command returns “missing value” instead of open document

My setup: Mac OS X 10.7.4 Xcode 4.3.2

I have a Mac OS X based application that is created against the 10.6 SDK.

I used to always create this app in Xcode3 on Snow Leopard.

I recently updated the application project so that it can be created under Xcode4 on Lion (although I'm still building against the 10.6 SDK).

After creating under Xcode4 / Lion, I noticed a strange change in the behavior of AppleScript for which I cannot find the root cause. The problem is this:

An open AppleScript command returns missing value, not the document that was opened.

So this code:

tell application "MyApp"
    set doc_ to open (get path to desktop as string) & "test.myext"
    doc_ -- prints the return value in the console
end tell

, Xcode3/Lion:

document 1 of application "MyApp"

, Xcode4/Lion:

missing value

. - AppleScript open.

, , , . , , , :

-[NSApplication handleOpenScriptCommand:]

Xcode3 , NSDocument. AppleScript open .

Xcode4 NSDocument. , ,

-[NSDocument openDocumentWithContentsOfURL:display:]

and return immediately. This causes the AppleScript command to openreceive missing valueas the return value.

So, I'm trying to figure out what I did to make this change.

Firstly, I suspected that I was (incorrectly) using the Asynchronous Document Opening feature introduced in 10.6. However, I checked, and I did NOT cancel this method:
+[NSDocument canConcurrentlyReadDocumentsOfType:]

So I even tried to redefine it and return it NO.

+ (BOOL)canConcurrentlyReadDocumentsOfType:(NSString *)typeName {
    return NO;
}

This does NOT fix my problem.

So can anyone offer advice? How can I break the AppleScript command opento make it execute asynchronously (when I really want to synchronously) and return missing value(when I really want the created document)?

UPDATE

I found something very amazing!

: , Mac App Store. ( ) Xcode. :

MyAppIndie

MyAppAppStore

, Indie. AppStore .

,, OS OS, Indie AppStore, , !

AppStore . Indie .

, , , , - . .

. .

+3
1

Finder:

tell application "Finder"
    set doc_ to open (get path to desktop as string) & "test.myext"
end tell
-1

All Articles