Permalink
Browse files

oh geeze

  • Loading branch information...
1 parent 85cf916 commit ee99867e955d9214652089ae77054a914416953f @ccgus committed Mar 5, 2009
Showing with 40,988 additions and 0 deletions.
  1. +25 −0 example_scripts/Acorn.jstalk
  2. +9 −0 example_scripts/AcornNewImage.jstalk
  3. +70 −0 example_scripts/AcornNewImageWithCurvedDropShadow.jstalk
  4. +6 −0 example_scripts/Alert Box.jstalk
  5. +33 −0 example_scripts/FlickrImages.jstalk
  6. +12 −0 example_scripts/Help Me Write Code.jstalk
  7. +39 −0 example_scripts/JSTalk.py
  8. +22 −0 example_scripts/Mail.jstalk
  9. +20 −0 example_scripts/Open Shell in Finder.jstalk
  10. +8 −0 example_scripts/Set Finder Comment.jstalk
  11. +9 −0 example_scripts/VoodooPad.jstalk
  12. +18 −0 example_scripts/VoodooPad.py
  13. +2 −0 example_scripts/iChat.jstalk
  14. +252 −0 extras/acornplugin/ACPlugin.h
  15. BIN extras/acornplugin/English.lproj/InfoPlist.strings
  16. +15 −0 extras/acornplugin/Grayscale.js
  17. +26 −0 extras/acornplugin/Info.plist
  18. +7 −0 extras/acornplugin/JSEnablerPlugIn.h
  19. +97 −0 extras/acornplugin/JSEnablerPlugIn.m
  20. +64 −0 extras/acornplugin/PictureShadow.js
  21. +1,422 −0 extras/acornplugin/jsenabler.xcodeproj/gus.mode1v3
  22. +138 −0 extras/acornplugin/jsenabler.xcodeproj/gus.pbxuser
  23. +333 −0 extras/acornplugin/jsenabler.xcodeproj/project.pbxproj
  24. +13 −0 extras/acornplugin/jsenabler_Prefix.pch
  25. +16 −0 extras/inputmanager/bin/install.sh
  26. +16 −0 extras/inputmanager/bin/makedist.sh
  27. +8 −0 extras/inputmanager/bin/rmsymlinks.sh
  28. +24 −0 extras/inputmanager/bin/symlinks-make.sh
  29. BIN extras/inputmanager/dist/JSTalkEverywhere.tgz
  30. +18 −0 extras/inputmanager/dist/JSTalkEverywhere/Info
  31. +65 −0 ...re/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Headers/BridgeSupportController.h
  32. +174 −0 ...erywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Headers/JSCocoaController.h
  33. +90 −0 ...rywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Headers/JSCocoaFFIArgument.h
  34. +42 −0 ...erywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Headers/JSCocoaFFIClosure.h
  35. +77 −0 ...where/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Headers/JSCocoaPrivateObject.h
  36. +32 −0 ...st/JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Headers/JSTalk.h
  37. BIN ...manager/dist/JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/JSTalk
  38. +20 −0 ...STalkEverywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Resources/Info.plist
  39. +644 −0 .../JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Resources/class.js
  40. +65 −0 ...erywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Headers/BridgeSupportController.h
  41. +174 −0 ...TalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Headers/JSCocoaController.h
  42. +90 −0 ...alkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Headers/JSCocoaFFIArgument.h
  43. +42 −0 ...TalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Headers/JSCocoaFFIClosure.h
  44. +77 −0 ...kEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Headers/JSCocoaPrivateObject.h
  45. +32 −0 ...erywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Headers/JSTalk.h
  46. BIN ...t/JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/JSTalk
  47. +20 −0 ...here/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Resources/Info.plist
  48. +644 −0 ...ywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/A/Resources/class.js
  49. +65 −0 ...re.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Headers/BridgeSupportController.h
  50. +174 −0 ...erywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Headers/JSCocoaController.h
  51. +90 −0 ...rywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Headers/JSCocoaFFIArgument.h
  52. +42 −0 ...erywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Headers/JSCocoaFFIClosure.h
  53. +77 −0 ...where.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Headers/JSCocoaPrivateObject.h
  54. +32 −0 ...re/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Headers/JSTalk.h
  55. BIN ...lkEverywhere/JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/JSTalk
  56. +20 −0 ...STalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Resources/Info.plist
  57. +644 −0 .../JSTalkEverywhere.bundle/Contents/Frameworks/JSTalk.framework/Versions/Current/Resources/class.js
  58. +20 −0 extras/inputmanager/dist/JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/Info.plist
  59. BIN extras/inputmanager/dist/JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/MacOS/JSTalkEverywhere
  60. BIN .../dist/JSTalkEverywhere/JSTalkEverywhere.bundle/Contents/Resources/English.lproj/InfoPlist.strings
  61. +1,392 −0 extras/inputmanager/jstalkeverywhere.xcodeproj/gus.mode1
  62. +1,425 −0 extras/inputmanager/jstalkeverywhere.xcodeproj/gus.mode1v3
  63. +1,558 −0 extras/inputmanager/jstalkeverywhere.xcodeproj/gus.mode2v3
  64. +436 −0 extras/inputmanager/jstalkeverywhere.xcodeproj/gus.pbxuser
  65. +354 −0 extras/inputmanager/jstalkeverywhere.xcodeproj/project.pbxproj
  66. +20 −0 extras/inputmanager/resources/English.lproj/ACCWindow.nib/classes.nib
  67. +16 −0 extras/inputmanager/resources/English.lproj/ACCWindow.nib/info.nib
  68. BIN extras/inputmanager/resources/English.lproj/ACCWindow.nib/keyedobjects.nib
  69. BIN extras/inputmanager/resources/English.lproj/InfoPlist.strings
  70. +18 −0 extras/inputmanager/resources/Info
  71. +24 −0 extras/inputmanager/resources/Info.plist
  72. +16 −0 extras/inputmanager/resources/version.plist
  73. +22 −0 extras/inputmanager/src/main.m
  74. +14 −0 extras/inputmanager/src/util/FOUtils.h
  75. +83 −0 extras/inputmanager/src/util/FOUtils.m
  76. +16 −0 extras/inputmanager/src/util/NSExceptionHacks.h
  77. +45 −0 extras/inputmanager/src/util/NSExceptionHacks.m
  78. BIN extras/voodoopadplugin/English.lproj/InfoPlist.strings
  79. +26 −0 extras/voodoopadplugin/Info.plist
  80. +26 −0 extras/voodoopadplugin/JavaScriptPluginEnabler.h
  81. +377 −0 extras/voodoopadplugin/JavaScriptPluginEnabler.m
  82. +7 −0 extras/voodoopadplugin/JavaScriptPluginEnabler_Prefix.pch
  83. +1,381 −0 extras/voodoopadplugin/VPJSTalkPlugin.xcodeproj/gus.mode1v3
  84. +54 −0 extras/voodoopadplugin/VPJSTalkPlugin.xcodeproj/gus.pbxuser
  85. +319 −0 extras/voodoopadplugin/VPJSTalkPlugin.xcodeproj/project.pbxproj
  86. +1 −0 extras/voodoopadplugin/VPPlugin.framework/Headers
  87. +1 −0 extras/voodoopadplugin/VPPlugin.framework/Resources
  88. +1 −0 extras/voodoopadplugin/VPPlugin.framework/VPPlugin
  89. +1 −0 extras/voodoopadplugin/VPPlugin.framework/VPPlugin.framework
  90. +21 −0 extras/voodoopadplugin/VPPlugin.framework/Versions/A/Headers/VPExporter.h
  91. +708 −0 extras/voodoopadplugin/VPPlugin.framework/Versions/A/Headers/VPPlugin.h
  92. +20 −0 extras/voodoopadplugin/VPPlugin.framework/Versions/A/Resources/Info.plist
  93. +20 −0 extras/voodoopadplugin/VPPlugin.framework/Versions/A/Resources/VPPlugin-Info.plist
  94. BIN extras/voodoopadplugin/VPPlugin.framework/Versions/A/VPPlugin
  95. +1 −0 extras/voodoopadplugin/VPPlugin.framework/Versions/Current
  96. +1,414 −0 jstalk.xcodeproj/project.pbxproj
  97. +29 −0 res/English.lproj/Credits.rtf
  98. BIN res/English.lproj/InfoPlist.strings
  99. +742 −0 res/English.lproj/JSTDocument.xib
  100. +3,521 −0 res/English.lproj/MainMenu.xib
  101. +51 −0 res/Info.plist
  102. +20 −0 res/JSTalkFramework-Info.plist
  103. +26 −0 res/JSTalkRunner-Info.plist
  104. BIN res/images/Clear.tiff
  105. BIN res/images/JSTalk.icns
  106. BIN res/images/JSTalk.png
  107. BIN res/images/JSTalkDocument.icns
  108. BIN res/images/Play.tiff
  109. +9 −0 res/main.jstalk
  110. +46 −0 res/sample.jstalk
  111. +65 −0 src/JSCocoa/BridgeSupportController.h
  112. +344 −0 src/JSCocoa/BridgeSupportController.m
  113. +9 −0 src/JSCocoa/JSCocoa.h
  114. +174 −0 src/JSCocoa/JSCocoaController.h
  115. +3,157 −0 src/JSCocoa/JSCocoaController.m
  116. +90 −0 src/JSCocoa/JSCocoaFFIArgument.h
  117. +1,102 −0 src/JSCocoa/JSCocoaFFIArgument.m
  118. +42 −0 src/JSCocoa/JSCocoaFFIClosure.h
  119. +213 −0 src/JSCocoa/JSCocoaFFIClosure.m
  120. +54 −0 src/JSCocoa/JSCocoaLib.h
  121. +196 −0 src/JSCocoa/JSCocoaLib.m
  122. +77 −0 src/JSCocoa/JSCocoaPrivateObject.h
  123. +124 −0 src/JSCocoa/JSCocoaPrivateObject.m
  124. +7 −0 src/JSCocoa/JSCocoa_Prefix.pch
  125. +644 −0 src/JSCocoa/class.js
  126. +16 −0 src/JSTAppDelegate.h
  127. +81 −0 src/JSTAppDelegate.m
  128. +50 −0 src/JSTDocument.h
  129. +457 −0 src/JSTDocument.m
  130. +14 −0 src/JSTExtras.h
  131. +135 −0 src/JSTExtras.m
  132. +27 −0 src/JSTListener.h
  133. +53 −0 src/JSTListener.m
  134. +49 −0 src/JSTPreprocessor.h
  135. +279 −0 src/JSTPreprocessor.m
  136. +16 −0 src/JSTRunnerApplication.h
  137. +52 −0 src/JSTRunnerApplication.m
  138. +51 −0 src/JSTScanner.h
  139. +220 −0 src/JSTScanner.m
  140. +16 −0 src/JSTTextView.h
  141. +292 −0 src/JSTTextView.m
  142. +32 −0 src/JSTalk.h
  143. +165 −0 src/JSTalk.m
  144. +17 −0 src/JSTalk_Prefix.pch
  145. +38 −0 src/MarkerLineNumberView.h
  146. +127 −0 src/MarkerLineNumberView.m
  147. +44 −0 src/NoodleLineNumberMarker.h
  148. +102 −0 src/NoodleLineNumberMarker.m
  149. +63 −0 src/NoodleLineNumberView.h
  150. +575 −0 src/NoodleLineNumberView.m
  151. +4,963 −0 src/jslint/fulljslint.js
  152. +32 −0 src/jstalkmain.m
  153. +147 −0 src/load_bundle.c
  154. +47 −0 src/load_bundle.h
  155. +362 −0 src/mach_inject.c
  156. +87 −0 src/mach_inject.h
  157. +100 −0 src/mach_inject_bundle.c
  158. +60 −0 src/mach_inject_bundle.h
  159. +118 −0 src/mach_inject_bundle_stub.c
  160. +21 −0 src/mach_inject_bundle_stub.h
  161. +14 −0 src/main.m
  162. +25 −0 src/todparsekit/TDAlternation.h
  163. +34 −0 src/todparsekit/TDAlternation.m
  164. +25 −0 src/todparsekit/TDAny.h
  165. +23 −0 src/todparsekit/TDAny.m
  166. +138 −0 src/todparsekit/TDAssembly.h
  167. +189 −0 src/todparsekit/TDAssembly.m
  168. +20 −0 src/todparsekit/TDCaseInsensitiveLiteral.h
  169. +19 −0 src/todparsekit/TDCaseInsensitiveLiteral.m
  170. +25 −0 src/todparsekit/TDChar.h
  171. +22 −0 src/todparsekit/TDChar.m
  172. +19 −0 src/todparsekit/TDCharacterAssembly.h
  173. +120 −0 src/todparsekit/TDCharacterAssembly.m
  174. +31 −0 src/todparsekit/TDCollectionParser.h
  175. +38 −0 src/todparsekit/TDCollectionParser.m
  176. +25 −0 src/todparsekit/TDComment.h
  177. +24 −0 src/todparsekit/TDComment.m
  178. +71 −0 src/todparsekit/TDCommentState.h
  179. +114 −0 src/todparsekit/TDCommentState.m
  180. +25 −0 src/todparsekit/TDDigit.h
  181. +23 −0 src/todparsekit/TDDigit.m
  182. +26 −0 src/todparsekit/TDEmpty.h
  183. +24 −0 src/todparsekit/TDEmpty.m
  184. +25 −0 src/todparsekit/TDLetter.h
  185. +23 −0 src/todparsekit/TDLetter.m
  186. +28 −0 src/todparsekit/TDLiteral.h
  187. +55 −0 src/todparsekit/TDLiteral.m
  188. +16 −0 src/todparsekit/TDLowercaseWord.h
  189. +24 −0 src/todparsekit/TDLowercaseWord.m
  190. +18 −0 src/todparsekit/TDMultiLineCommentState.h
  191. +149 −0 src/todparsekit/TDMultiLineCommentState.m
  192. +16 −0 src/todparsekit/TDNonReservedWord.h
  193. +29 −0 src/todparsekit/TDNonReservedWord.m
  194. +25 −0 src/todparsekit/TDNum.h
  195. +24 −0 src/todparsekit/TDNum.m
  196. +31 −0 src/todparsekit/TDNumberState.h
  197. +143 −0 src/todparsekit/TDNumberState.m
  198. +77 −0 src/todparsekit/TDParseKit.h
  199. +99 −0 src/todparsekit/TDParser.h
  200. +113 −0 src/todparsekit/TDParser.m
  201. +26 −0 src/todparsekit/TDQuoteState.h
  202. +49 −0 src/todparsekit/TDQuoteState.m
  203. +25 −0 src/todparsekit/TDQuotedString.h
  204. +24 −0 src/todparsekit/TDQuotedString.m
  205. +46 −0 src/todparsekit/TDReader.h
  206. +61 −0 src/todparsekit/TDReader.m
  207. +64 −0 src/todparsekit/TDRepetition.h
  208. +80 −0 src/todparsekit/TDRepetition.m
  209. +17 −0 src/todparsekit/TDReservedWord.h
  210. +43 −0 src/todparsekit/TDReservedWord.m
  211. +22 −0 src/todparsekit/TDScientificNumberState.h
  212. +79 −0 src/todparsekit/TDScientificNumberState.m
  213. +25 −0 src/todparsekit/TDSequence.h
  214. +37 −0 src/todparsekit/TDSequence.m
  215. +24 −0 src/todparsekit/TDSignificantWhitespaceState.h
  216. +68 −0 src/todparsekit/TDSignificantWhitespaceState.m
  217. +17 −0 src/todparsekit/TDSingleLineCommentState.h
  218. +97 −0 src/todparsekit/TDSingleLineCommentState.m
  219. +32 −0 src/todparsekit/TDSpecificChar.h
  220. +31 −0 src/todparsekit/TDSpecificChar.m
  221. +34 −0 src/todparsekit/TDSymbol.h
  222. +73 −0 src/todparsekit/TDSymbol.m
  223. +37 −0 src/todparsekit/TDSymbolNode.h
  224. +76 −0 src/todparsekit/TDSymbolNode.m
  225. +42 −0 src/todparsekit/TDSymbolRootNode.h
  226. +147 −0 src/todparsekit/TDSymbolRootNode.m
  227. +38 −0 src/todparsekit/TDSymbolState.h
  228. +71 −0 src/todparsekit/TDSymbolState.m
  229. +43 −0 src/todparsekit/TDTerminal.h
  230. +89 −0 src/todparsekit/TDTerminal.m
  231. +147 −0 src/todparsekit/TDToken.h
  232. +223 −0 src/todparsekit/TDToken.m
  233. +62 −0 src/todparsekit/TDTokenArraySource.h
  234. +80 −0 src/todparsekit/TDTokenArraySource.m
  235. +57 −0 src/todparsekit/TDTokenAssembly.h
  236. +192 −0 src/todparsekit/TDTokenAssembly.m
  237. +133 −0 src/todparsekit/TDTokenizer.h
  238. +207 −0 src/todparsekit/TDTokenizer.m
  239. +40 −0 src/todparsekit/TDTokenizerState.h
  240. +124 −0 src/todparsekit/TDTokenizerState.m
  241. +26 −0 src/todparsekit/TDTrack.h
  242. +73 −0 src/todparsekit/TDTrack.m
  243. +25 −0 src/todparsekit/TDTrackException.h
  244. +15 −0 src/todparsekit/TDTrackException.m
  245. +16 −0 src/todparsekit/TDUppercaseWord.h
  246. +24 −0 src/todparsekit/TDUppercaseWord.m
  247. +42 −0 src/todparsekit/TDWhitespaceState.h
  248. +100 −0 src/todparsekit/TDWhitespaceState.m
  249. +25 −0 src/todparsekit/TDWord.h
  250. +24 −0 src/todparsekit/TDWord.m
  251. +25 −0 src/todparsekit/TDWordOrReservedState.h
  252. +43 −0 src/todparsekit/TDWordOrReservedState.m
  253. +43 −0 src/todparsekit/TDWordState.h
  254. +115 −0 src/todparsekit/TDWordState.m
@@ -0,0 +1,25 @@
+// Note, this requires the Acorn JSEnabler plugin to be installed.
+// http://code.google.com/p/flycode/source/browse/trunk/jstalk/extras/acornplugin/
+
+// application: gets an object from Acorn over DO
+var acorn = [JSTalk application:"Acorn"];
+var outPath = "/tmp/jimi.png";
+var firstDoc = [[acorn orderedDocuments] objectAtIndex:0];
+
+for (i = 0; i < 10; i++) {
+ [[firstDoc windowController] callFilterWithName:"CIGaussianBlur"];
+ [NSThread sleepForTimeInterval:0.2];
+}
+
+[[firstDoc dataRepresentationOfType:"public.png"] writeToFile:outPath];
+
+[[firstDoc undoManager] undo];
+
+var qt = [SBApplication application:"QuickTime Player"];
+
+print(qt);
+
+[qt open:[NSURL fileURLWithPath: outPath]];
+[qt activate];
+
+print("Hurray!");
@@ -0,0 +1,9 @@
+var imageURL = [NSURL URLWithString:"http://flyingmeat.com/images/fmlogo.pdf"];
+
+var image = [[[NSImage alloc] initWithContentsOfURL:imageURL] autorelease];
+
+var acorn = [JSTalk application:"Acorn"];
+
+[[acorn sharedDocumentController] newDocumentWithImageData:[image TIFFRepresentation]];
+
+
@@ -0,0 +1,70 @@
+var acorn = [JSTalk application:"Acorn"];
+var doc = [[acorn orderedDocuments] objectAtIndex:0];
+var image = [[[NSImage alloc] initWithData:[doc dataRepresentationOfType:"public.png"]] autorelease];
+var bitmap = [image bestRepresentationForDevice:nil];
+
+var extent = NSMakeRect(0, 0, [bitmap pixelsWide], [bitmap pixelsHigh]);
+var xOffset = 5;
+var yOffset = 35;
+var curveHeight = 15;
+var imageYOffset = 10;
+var whiteBorderWidth = 4;
+var doubleBorderWidth = whiteBorderWidth * 2;
+
+var newSize = NSMakeSize(extent.size.width + (whiteBorderWidth * 2),
+ extent.size.height + imageYOffset + (whiteBorderWidth * 2));
+
+var newImage = [[[NSImage alloc] initWithSize:newSize] autorelease];
+
+[newImage lockFocus];
+
+[[NSGraphicsContext currentContext] saveGraphicsState];
+
+var shadow = [[NSShadow alloc] init];
+[shadow setShadowColor:[[NSColor blackColor] colorWithAlphaComponent:.6]];
+
+var shadowOffset = NSMakeSize(0, -(yOffset + 5));
+[shadow setShadowOffset:shadowOffset];
+[shadow setShadowBlurRadius:5];
+shadow.set()
+
+// make a curved path, at the bottom of our image.
+bezierPath = NSBezierPath.bezierPath()
+
+bezierPath.moveToPoint_(NSMakePoint(xOffset, 40 + yOffset))
+bezierPath.lineToPoint_(NSMakePoint(extent.size.width - (xOffset) + doubleBorderWidth, 40 + yOffset))
+bezierPath.lineToPoint_(NSMakePoint(extent.size.width - (xOffset) + doubleBorderWidth, 10 + yOffset))
+
+bezierPath.curveToPoint_controlPoint1_controlPoint2_(NSMakePoint(newSize.width / 2, curveHeight + yOffset),
+ NSMakePoint(extent.size.width - (xOffset), 10 + yOffset),
+ NSMakePoint(newSize.width *.75, curveHeight + yOffset))
+
+bezierPath.curveToPoint_controlPoint1_controlPoint2_(NSMakePoint(xOffset, 10 + yOffset),
+ NSMakePoint(newSize.width *.25, curveHeight + yOffset),
+ NSMakePoint(xOffset, 10 + yOffset))
+
+print(bezierPath);
+
+bezierPath.fill()
+
+// get rid of our shadow
+NSGraphicsContext.currentContext().restoreGraphicsState()
+
+// draw a white border
+NSColor.whiteColor().set()
+NSBezierPath.bezierPathWithRect_(NSMakeRect(0, imageYOffset, newSize.width, extent.size.height + whiteBorderWidth * 2)).fill()
+
+
+// draw our gray border around the white border
+NSColor.lightGrayColor().set()
+NSBezierPath.bezierPathWithRect_(NSMakeRect(.5, imageYOffset + .5 , newSize.width - 1, (extent.size.height - 1) + (whiteBorderWidth * 2))).stroke()
+
+// NSImage takes into account dpi of the image. So we force it's size, to avoid small images.
+[image setSize: extent.size];
+
+// draw our image
+image.drawAtPoint_fromRect_operation_fraction_(NSMakePoint(whiteBorderWidth, imageYOffset + whiteBorderWidth), NSMakeRect(0, 0, extent.size.width, extent.size.height), NSCompositeCopy, 1)
+
+[newImage unlockFocus];
+
+[[acorn sharedDocumentController] newDocumentWithImageData:[newImage TIFFRepresentation]];
@@ -0,0 +1,6 @@
+var jst = [JSTalk application:"JSTalk Editor"];
+
+if ([jst displayDialog:"Hello" withTitle:@"What?"] == NSOKButton) {
+ print("woo");
+}
+
@@ -0,0 +1,33 @@
+var url = [NSURL URLWithString:"http://api.flickr.com/services/feeds/photos_public.gne?id=87865690@N00&lang=en-us&format=rss_200"];
+var xmlDoc = [[[NSXMLDocument alloc] initWithContentsOfURL:url options:null error:null] autorelease];
+var root = [xmlDoc rootElement];
+var tmpDir = NSTemporaryDirectory() + "ccgus/";
+
+[[NSFileManager defaultManager] createDirectoryAtPath:tmpDir attributes:nil];
+
+var ar = [root nodesForXPath:"channel/item/description/." error:null];
+
+for (i=0; i < [ar count]; i++) {
+
+ var s = ar[i] + ""; // coerce this into a js string
+
+ urlstart = s.search('src="http') + 5;
+
+ s = s.substr(urlstart);
+
+ urlend = s.search('"');
+
+ s = s.substr(0, urlend);
+
+ var imgURL = [NSURL URLWithString:s];
+ var fileName = [[imgURL path] lastPathComponent];
+
+ var imageData = [NSData dataWithContentsOfURL: imgURL];
+
+ if (imageData) {
+ // writeToFile is defined in JSTExtras
+ [imageData writeToFile: tmpDir + fileName];
+ }
+}
+
+[[NSWorkspace sharedWorkspace] openFile: tmpDir];
@@ -0,0 +1,12 @@
+var s = "break case catch continue default delete do else finally for function if in instanceof new return switch this throw try typeof var void while with abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile null true false nil";
+
+words = s.split(" ");
+var i = 0;
+list = "";
+while (i < words.length) {
+ list = list + '@"' + words[i] + '", ';
+ i++
+}
+
+print("NSArray *blueWords = [NSArray arrayWithObjects:" + list + " nil];");
+
View
@@ -0,0 +1,39 @@
+from Foundation import *
+from AppKit import *
+import time
+
+def application(appName):
+ appPath = NSWorkspace.sharedWorkspace().fullPathForApplication_(appName);
+
+ if (not appPath):
+ print("Could not find application '" + appName + "'")
+ return None
+
+
+ appBundle = NSBundle.bundleWithPath_(appPath)
+ bundleId = appBundle.bundleIdentifier()
+
+
+ NSWorkspace.sharedWorkspace().launchAppWithBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifier_(bundleId, NSWorkspaceLaunchWithoutActivation | NSWorkspaceLaunchAsync, None, None)
+
+ port = bundleId + ".JSTalk"
+
+ conn = None
+ tries = 0
+
+ while ((conn is None) and (tries < 10)):
+ conn = NSConnection.connectionWithRegisteredName_host_(port, None)
+ tries = tries + 1;
+
+ if (not conn):
+ time.sleep(1)
+
+ if (not conn):
+ print("Could not find a JSTalk connection to " + appName)
+ return None
+
+ return conn.rootProxy()
+
+
+def proxyForApp(appName):
+ return application(appName)
@@ -0,0 +1,22 @@
+var mail = [SBApplication application:"Mail"];
+
+var to = "someone@somewhere.com";
+var from = "someone@somewhere.com";
+var subject = "This is the subject.";
+var content = "This is the message content.\n\nIsn't it great?";
+
+var emailMessageProps = {subject:subject, content:content};
+var emailMessage = [[[mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties:emailMessageProps];
+
+[[mail outgoingMessages] addObject:emailMessage];
+
+emailMessage.sender = from;
+emailMessage.visible = true;
+
+theRecipientProps = {address:from};
+theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties: theRecipientProps];
+
+[[emailMessage toRecipients] addObject:theRecipient];
+
+[emailMessage send];
+
@@ -0,0 +1,20 @@
+var windows = [[SBApplication application:"Finder"] windows];
+
+if ([windows count] > 0) {
+
+ // from SBObject:
+ // get() "Forces evaluation of the receiver, causing the real object to be returned immediately."
+ var win = windows[0].get();
+ var target = win.target().get();
+ var url = [NSURL URLWithString:[target URL]];
+ var path = [url path].replace("%20", " ");
+
+ var terminal = [SBApplication application:"Terminal"];
+
+ [terminal activate];
+
+ [terminal doScript:"cd '" + [url path] + "'" in:nil];
+}
+else {
+ print("There's no window open")
+}
@@ -0,0 +1,8 @@
+var finder = [SBApplication application:"Finder"];
+
+// notice that the @ is making the string an NSString instance.
+// the fileURL method is part of the JSTalk "Extras" categories
+var url = [@"/Volumes/srv/Users/gus/Desktop/foo.pict" fileURL]
+var item = [[finder items] objectAtLocation:url];
+
+item.comment = "Hello World!";
@@ -0,0 +1,9 @@
+var VoodooPad = [JSTalk application:"VoodooPad Pro"];
+
+var firstDoc = [[VoodooPad orderedDocuments] objectAtIndex:0];
+
+print(firstDoc);
+
+indexText = [[[firstDoc pageForKey:"index"] dataAsAttributedString] string];
+
+print(indexText);
@@ -0,0 +1,18 @@
+import JSTalk
+
+vp = JSTalk.application("VoodooPad Pro")
+
+print(vp)
+
+firstDoc = vp.orderedDocuments().objectAtIndex_(0)
+
+for pageKey in firstDoc.keys():
+ print(pageKey)
+
+ page = firstDoc.pageForKey_(pageKey)
+
+ if (page.uti() == "com.fm.page"):
+ pageText = page.dataAsAttributedString().string()
+ print(pageText)
+
+
@@ -0,0 +1,2 @@
+
+[[SBApplication application:"iChat"] setStatusMessage:"Happy (funball)"];
Oops, something went wrong.

0 comments on commit ee99867

Please sign in to comment.