Skip to main content
Participating Frequently
May 12, 2008
Question

Two simple SnippetRunner questions which I cannot answer.

  • May 12, 2008
  • 2 replies
  • 425 views
I've started with "JavaScripting" and to be honest I am still confused. I played a little bit with SnippetRunner example.So I have two questions.

1)Where does "sdkCodeSnippetRunnerObject" name come from?

In "snippetrunner\examplefiles\scripts\javascript\SnippetRunner.jsx" is this.

>// get the SDKCodeSnippetRunner object
var snippetRunner = app.sdkCodeSnippetRunnerObject;

I understand that in xxxx.fr there is defined "sdkCodeSnippetRunnerObject" object and is added to application object but when I tried to find this string in source codes "sdkCodeSnippetRunnerObject" simply didn't exist....

2)How can I run some snippetRunner method?
I wrote this.

>var snippet = snippetRunner.sdkCodeSnippets.item(53);
if (snippet.canRun() == true)
snippet.run();

but it didn't work. 53 should be PlaceFile snippet.

Thanks,
pyso
This topic has been closed for replies.

2 replies

Inspiring
May 17, 2008
Inside the .fr the name is formatted as multiple words separated by spaces matching the notation for AppleScript. The capitalization is just a different formatting for JavaScript. For your object, see SnipRun.fr line 1319, below the kSnipRunObjectScriptElement ID.

There are also plenty details in the sdkdocs, e.g. scriptable-plugin.pdf

And Ole is right that these questions are better asked in the SDK forum.

Regards,
Dirk
Known Participant
May 12, 2008
Hi pyso,

This is an SDK question, not a scripting question (even though it involves a JavaScript). Try posting in the SDK forum.

(Given this response, you might wonder why many of the example scripts contain a "mySnippet" function. We will eventually have a "ScriptSnippetRunner" that is roughly analagous to the SnippetRunner in the SDK, but it's not yet available.)

Thanks,

Ole
Harbs.
Legend
May 13, 2008
> We will eventually have a "ScriptSnippetRunner" that is roughly analagous to the SnippetRunner in the SDK, but it's not yet available.)
>
Cool! Can't wait... :)

Harbs