Core Image Transitions

Hi all,

Is it possible to use core image transitions from within AppleScript Studio.

I have searched extensively without success for any examples of how this can be achieved.

Can anyone reading this please give some advice.

TIA

Tellboy

Greetings, tellboy.

I’m not very familiar with image processing using core image, but I’ve put some time in with obj-c methods in ASS, so I’ll throw out my thoughts and you can take from them what you wish. Applescript studio is pretty much just an applescript front end to cocoa/obj-c. This being said, it is actually pretty simple to gain access to just about anything you’d like to, given that it can be accomplished in obj-c. For simple calls to obj-c methods, you can sometimes get away with just using ‘call method’ and the appropriate syntax for that method. Call method can get touchy with some data types, though… especially more complex ones like image processing… so using it to do long, multi-step actions can become impossible when trying to find the right syntax and data coercions. For more complex actions, you will definitely want to write custom obj-c methods which perform your entire action in obj-c without moving back-and-forth between AS and obj-c, and then make calls to them via your applescript. Granted, this still requires that you use and understand obj-c, but it eliminates having to write all of your other code and interface-handling routines in obj-c, too.

If you could find some samples of obj-c code that do what you’re looking for, we could probably help you get them tweaked for use as custom methods for your ASS app. This is assuming that there are cocoa methods available to you, and that carbon is not all you’ve got to work with.

j

jobu,

Thanks for the advice. I will see what I can find.

I am interested in understanding how to incorporate cocoa routines into AppleScript Studio and would appreciate any pointers in the direction of some low key and easy examples that I could follow to start to develop an interest.

Earlier excursions into cocoa interface design have been unsuccesful so your suggestion of implementing the interface in AppleScript Studio and joining with Cocoa routines is appealing and may be a way forward for me.

I need success to maintain my interest and to date trying to develop simple cocoa applications has not provided that.

Do you know of any good sites or examplesthat may offer a slow learning curve.

All the best

tellboy

As a low-level example, see: http://bbs.applescript.net/viewtopic.php?id=14146

Now for a bit of explanation as to what is going on.

  1. We could include or exclude the "#import <Cocoa/Cocoa.h> line. If excluded we can’t use NSApplication as that is a Cocoa class, so we would substitute NSString. Unfortunately, then you have to do: call method “someFunc:” of “ThisIsTheAnnoyingPartIfYouHaveALotOfThem” with params… (where “ThisIsThe…” is just “ASSURL” in this example). So its just shorter to have the Cocoa include line. And at this level, a “#import” is the same as “#include”.

  2. You figure out what to #import/#include by reading documentation. For example, “man strscmp” shows that I need to “#include <string.h>”. The CoreFoundation documentation:

file:///Developer/ADC%20Reference%20Library/documentation/CoreFoundation/Reference/CFURLRef/index.html

shows that I need to include the CoreFoundation header (I want the CFStringRef data type) and CFURL.h - or just the main header file for short. Things that are system level are in <>, headers in your project are in quotes.

  1. Note how the functions begin with a declaration of "- (NSString *) - most things in Cocoa work on pointers (denoted by *). This declaration means that the functions returns something - and this something is an NSString. Applescript can’t handle most data types - stick to things like int, unsigned short, char, str, NSString… its just easier in the long run. A declaration of “- (void)” means it will not return anything.

  2. Your functions get working parameters from what you pass to it. Going from Applescript Studio to Objective-C, you pass variables after the “with parameters” part as a list {}. First you need to decide what, if any, data type you will return, then whether your function takes arguments or not. For example, if you were trying to return a formatted time using “strftime” then you don’t need an input variable - which means your function should not have a colon (“:”) at the end. If you do require an input variable, then you require a colon, and then the data type the variable is, and then the varaible name. Add a space and repeat with another method, data type & variable name as needed. So:

  • (void)encodeTime //no input variables
    //no variables
    //ASS: call method “encodeTime”
  • (void)encodeFormattedTime:(NSString *)timeFormat
    //1 variable - timeFormat of type NSString
    //ASS: call method “encodeFormattedTime:” with parameters {“%g %V %uT%s”}
  • (NSString *)encodeTime:(NSString *)inTime withFormat:(NSString *)timeFormat
    //2 variables (both NSString): inTime & timeFormat
    //ASS: call method “encodeTime:withFormat:” with parameters {givenTime, “UTC: %z”}