• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Enable Scripting Failing - Missing something? Based on SimpleScripingVerbs sample
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enable Scripting Failing - Missing something? Based on SimpleScripingVerbs sample


  • Subject: Enable Scripting Failing - Missing something? Based on SimpleScripingVerbs sample
  • From: "Adam Venturella" <email@hidden>
  • Date: Tue, 13 Jan 2009 13:17:11 -0800

I have been reading over the docs re: Implementing Scripting for the
last couple of hours:
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_implement/chapter_4_section_1.html#//apple_ref/doc/uid/20000037-BBCJEEEC

Looked Over this sample from the docs:
Implementing a Verb-First Command-Align
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_script_cmds/chapter_8_section_4.html#//apple_ref/doc/uid/20001242-SW7


I took a look at the sample application:
http://developer.apple.com/samplecode/SimpleScriptingVerbs/index.html
SimpleScriptingVerbs

Seems simple enough, so I wanted to start a new application, to make
sure I had my understanding correct.  I am literally copying the
SimpeCommand.h/m from the SimpleScriptingVerbs sample and trying to
implement that.
My process has been:

1) create new Cocoa application
2) Edit Info.plist to enable scripting and point to the script definition file:

<key>NSAppleScriptEnabled</key>
<true/>

<key>OSAScriptingDefinition</key>
<string>MyScriptingDef.def</string>


3) create MyScriptingDef.def:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary xmlns:xi="http://www.w3.org/2003/XInclude";>

       <xi:include
href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef"
xpointer="xpointer(/dictionary/suite)"/>

	<suite name="Simple Scripting Verbs" code="SVrb"
description="Terminology for the SimpleScriptingVerbs Sample.">
		<command name="do simple command" code="SVrbSimp" description="run a
simple command with no parameters">
			<cocoa class="SimpleCommand"/>
			<result type="integer" description="returns the number seven"/>
		</command>
	</suite>
</dictionary>

4) check my targets to make sure MyScriptingDef.def is included in the
Copy Bundle Resources ( it is)

5) created SimpleCommand.h/m (which I copy from the
SimpleScriptingVerbs minus the scriptLog.h related files):
SimpleCommand.h:
#import <Cocoa/Cocoa.h>
@interface SimpleCommand : NSScriptCommand {
}
- (id)performDefaultImplementation;
@end

SimpleCommand.m:
#import "SimpleCommand.h"
@implementation SimpleCommand
- (id)performDefaultImplementation {
	/* return 7 to show how to return a number from a command */
	return [NSNumber numberWithInt:7];
}
@end





5) Run the application

6) open the script editor:
tell application "COCOA_Scriptable"
   do simple command
end tell

7) compile it and I get this error:
Syntax Error
Expected end of line but found identifier

8) click OK and I see in the script editor that "simple" is
highlighted in "do simple command"

9) look at SimpleScriptingVerbs(SimpleScriptingVerbsTest.applescript):
tell application "SimpleScriptingVerbs"
	do simple command
end tell

10) test that app, everything works.


Am I missing something fundamental in my application?  It looks
exactly the same as the SimpleScriptingVerbs, but since it doesn't
function the same I must have missed a step somewhere?
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Using UIImageView for animations
  • Next by Date: Constructing class names dynamically
  • Previous by thread: Re: dynamic resizing of a window
  • Next by thread: Constructing class names dynamically
  • Index(es):
    • Date
    • Thread