Permalink
Browse files

Automator goodness.

  • Loading branch information...
1 parent 847e5b2 commit 23102306a667478347eb2b8976819a1d45b85a92 August Mueller committed Sep 10, 2009
Binary file not shown.
View
@@ -12,30 +12,55 @@
@implementation JSTAutomator
+- (void) setupJSTalkEnv:(JSTalk *)jstalk {
+ JSCocoaController *jsController = [jstalk jsController];
+ jsController.delegate = self;
+ jstalk.printController = self;
+
+}
+
+- (void) print:(NSString*)s {
+ NSLog(@"%@", s);
+}
- (id)runWithInput:(id)input fromAction:(AMAction *)anAction error:(NSDictionary **)errorInfo {
// Add your code here, returning the data to be passed to the next action.
- NSLog(@"input: %@", input);
- NSLog(@"anAction: %@", anAction);
-
id result = 0x00;
NSString *script = [[self parameters] objectForKey:@"script"];
+ NSLog(@"script: %@", script);
+
if (script) {
- JSTalk *t = [[[JSTalk alloc] init] autorelease];
- [t executeString:script];
- result = [t callFunctionNamed:@"run" withArguments:[NSArray arrayWithObjects:input, nil]];
+ JSTalk *jstalk = [[[JSTalk alloc] init] autorelease];
+ [self setupJSTalkEnv:jstalk];
+
+ [jstalk executeString:script];
+ result = [jstalk callFunctionNamed:@"run" withArguments:[NSArray arrayWithObjects:input, [self parameters], nil]];
+
+ NSLog(@"result: %@", result);
+
}
- return input;
+ return result;
}
+
+- (void) JSCocoa:(JSCocoaController*)controller hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url {
+
+ lineNumber -= 1;
+
+ NSLog(@"Error on line %d, %@", lineNumber, error);
+
+}
+
+
- (void) runScript:(id)sender {
JSTalk *t = [[[JSTalk alloc] init] autorelease];
+ [self setupJSTalkEnv:t];
[t executeString:[[scriptView textStorage] string]];
id result = [t callFunctionNamed:@"run" withArguments:[NSArray array]];
(void) result;
@@ -477,6 +477,8 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
+ <integer>15</integer>
+ <integer>14</integer>
<integer>0</integer>
</array>
</array>
@@ -500,7 +502,7 @@
<real>283</real>
</array>
<key>RubberWindowFrame</key>
- <string>1502 463 300 709 0 0 1920 1178 </string>
+ <string>1300 453 300 709 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -537,7 +539,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>274304913.40956801</real>
+ <real>274305627.44200099</real>
<key>ToolbarDisplayMode</key>
<integer>2</integer>
<key>ToolbarIsVisible</key>
@@ -552,16 +554,15 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>CC8BC3F110598F91008A3BFC</string>
<string>CC8BC3E910598F3D008A3BFC</string>
<string>CC8BC3EA10598F3D008A3BFC</string>
<string>1CD10A99069EF8BA00B06720</string>
- <string>/Volumes/srv/Users/gus/Projects/jstalk/automator/jstalk-automator.xcodeproj</string>
<string>CC9AF1570F60D3A900F0F00B</string>
<string>1C78EAAD065D492600B07095</string>
+ <string>/Volumes/srv/Users/gus/Projects/jstalk/automator/jstalk-automator.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>1502 463 300 709 0 0 1920 1178 </string>
+ <string>1300 453 300 709 0 0 1920 1178 </string>
<key>WindowToolsV3</key>
<array>
<dict>
@@ -651,7 +652,7 @@
<key>WindowToolGUID</key>
<string>CC9AF1570F60D3A900F0F00B</string>
<key>WindowToolIsVisible</key>
- <true/>
+ <false/>
</dict>
<dict>
<key>FirstTimeWindowDisplayed</key>
@@ -1,7 +1,7 @@
// !$*UTF8*$!
{
089C1669FE841209C02AAC07 /* Project object */ = {
- activeBuildConfigurationName = Debug;
+ activeBuildConfigurationName = Release;
activeExecutable = 658A2E03067AB99300421F51 /* Automator */;
activeTarget = 8D5B49AC048680CD000E48DA /* JSTAutomator */;
addToTargets = (
View
@@ -59,12 +59,10 @@ cd /tmp
source ~/.bash_profile
echo "doing remote checkout ($revision) upload($upload)"
-#svn co $revision https://flycode.googlecode.com/svn/trunk/jstalk jstalk
git clone git://github.com/ccgus/jstalk.git
cd /tmp/jstalk
-#v=`svnversion -n /tmp/jstalk`
v=`date "+%s"`
echo setting build id
@@ -116,6 +114,16 @@ if [ $? != 0 ]; then
exit
fi
+cd /tmp/jstalk/automator/
+$xcodebuild -configuration Release OBJROOT=/tmp/jstalk/build SYMROOT=/tmp/jstalk/build OTHER_CFLAGS="" -target JSTAutomator
+if [ $? != 0 ]; then
+ echo "****** Bad build for automator action ********"
+ exit
+fi
+
+mkdir -p /tmp/jstalk/build/Release/JSTalk\ Editor.app/Contents/Library/Automator
+mv /tmp/jstalk/build/Release/JSTalk.action /tmp/jstalk/build/Release/JSTalk\ Editor.app/Contents/Library/Automator/.
+
if [ ! -d ~/cvsbuilds ]; then
mkdir ~/cvsbuilds
fi

0 comments on commit 2310230

Please sign in to comment.