Just created a fresh app and hit run and it fails with this error:
«app name»/Document.applescript:55: error: Expected end of line, etc. but found “script”. (-2741)
Command /usr/bin/osacompile failed with exit code 1
Anyone have any clue what this means? This is a FRESH app creation.
Model: MacBook Pro
Browser: Safari 533.16
Operating System: Mac OS X (10.7)
This is the script that was automatically created by Xcode:
script Document
property parent : class "NSDocument"
on init()
continue init()
-- Add your subclass-specific initialization here.
-- If an error occurs here, return missing value.
return me
end init
on windowNibName()
-- Override returning the nib file name of the document
-- If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
return "Document"
end windowNibName
on windowControllerDidLoadNib_(aController)
continue windowControllerDidLoadNib_(aController)
-- Add any code here that needs to be executed once the windowController has loaded the document's window.
end windowControllerDidLoadNib_
on dataOfType_error_(typeName, outError)
-- Insert code here to write your document to data of the specified type. If the given outError is not missing value, ensure that you set contents of outError when returning missing value.
-- You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
if outError is not missing value then
set contents of outError to my NSError's errorWithDomain_code_userInfo_(my NSOSStatusErrorDomain, my unimpErr, missing value)
end if
return missing value
end dataOfType_error_
on readFromData_ofType_error_(data, typeName, outError)
-- Insert code here to read your document from the given data of the specified type. If the given outError is not missing value, ensure that you set contents of outError when returning false.
-- You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
if outError is not missing value then
set contents of outError to my NSError's errorWithDomain_code_userInfo_(my NSOSStatusErrorDomain, my unimpErr, missing value)
end if
return true
end readFromData_ofType_error_
end script
Ironically a non-document based test app produces the exact same error, but does continue to launch. Are others having this problem with Xcode 4.3.2 on 10.7?
Interesting… Simply adding some custom code to the non-doc based app cleared up the error. So far the same isn’t true of the document based app. Still exploring.
script AppDelegate
property parent : class "NSObject"
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
test() -- added
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
-- Added
on Test()
display dialog "hello"
end
end script
This post solved my problem.
http://macscripter.net/viewtopic.php?id=38609
May thanks to all who participated in the conversation above!
FYI, these sorts of messages are but one of the reasons why it’s easier if you use an external editor (AppleScript Editor, Script Debugger, AppleScriptObjC Explorer) for your AS. Control-click on the name in the Navigator section and choose Open with External Editor.