How to (programmatically) change slides in a running Keynote presentation? - objective-c

I'm working on a Cocoa application I'd like to use to remotely (on the same machine, from a different process) control which slide is currently displayed in a running Apple iWork '09 Keynote presentation.
How should I approach this?

The Keynote Applescript dictionary has an advance command. Using:
Tell application "Keynote"
advance
end tell
seems to do what you require.
You can either use scripting bridge or NSApplescript to run this script from within a Cocoa application.

Related

How to show the NSUserNotification in command-line-tool program?

I want to write a command-line-tool program that only shows the NSUserNotification. I've found out, that in order to show the NSUserNotification I need to create a Cocoa App and is not what I want.
I want to run my program at log-in in background, so that my notification is always visible. How can I do that without creating a Cocoa App?
These are the options I found...
Trick Mac OS X into allowing a notification from a command-line tool.
Trigger the notification using Applescript or a helper application.
Create an Automator workflow & execute it using the automator command.
Automator provides a better experience than Applescript. Didn't try the helper.

Objective equivalent to AppleScript : Opening directory without bringing every finder window to from

There this AppleScript
tell application "Google Chrome" to set index of window 1 to 1
do shell script "open /Volumes"
Which opens a directory in Finder without bringing every onther Finder windows to the front.
Currently I'm using :
[[NSWorkspace sharedWorkspace] openURL:fileURL];
But it has the flaw to bring every Finder windows on the top of others.
Any idea how I could achieve the same behaviour as the AppleScript ?
You can always use NSAppleScript to run applescript code in Objective-C if Cocoa doesn't provide the functionality you want.
At a guess, -[NSWorkspace openURL:] also sends the application an activate event whereas the open process does not.
I'd recommend looking into the LaunchServices API. It's what both NSWorkspace and open use behind the scenes, but gives you more control than NSWorkspace's limited API.
--
p.s. If you do have to call out to open (or any other command line tool) from ObjC, you should use Cocoa's NSTask. (AppleScript's do shell script command is just its [crappy] equivalent of NSTask.)

Can you attach a drawer to another application in Cocoa?

Is there a way for one Cocoa application to attach drawer-like windows to another application? We might for example want a terminal drawer that followed around a particular Finder window.
There is a program called DTerm that opens little transparent windows over Finder windows, but one might prefer persistence.
You may want to checkout SIMBL. It allows you to write nifty bundles that are loaded into the application your targeting. If you go along with it I'd reccomend using class dump to gather more information on the application your working with (although Im not sure it would work with Finder)

possible to modifer the properties of windows in Objective C?

These are windows besides those that belong to the application. For example, how could I change the title of an open application, for example, TextEdit
You could use mach_inject and mach_override to load code into the target application and then simply use the Objective-C API's to access the window.
You could also try using applescript, but no idea if or how that is done.

Create a basic application that will act as a tutorial for how to use another app

I have a very particular application I have developed. I want to create a second app, ideally in visual basic, that provides a tutorial/ guide on how to use my original app step by step.
I imagine PowerPoint slide style images embedded in a simple window with forward & back controls.
I have experience in java, C & VB. Ideally the app needs be be kept simple and written in VB. Can anyone recommend a starting point, or if any tutorials for such exist? I've had a search and nothing stands out.
Thanks.
So, if this essentially just has slides and annotations and forward/backward buttons, why try to write an app for this? (I get that it might be fun to try.) You could simply do screen captures and annotate them and use PowerPoint and create an executable out of that to run.
You can even, I understand, create hyperlinks and such to allow the slide show to progress more like the real app does. I'm no "power point ranger" so I'd point you at the Office docs to learn about that, but I've seen some pretty good tutorials using this method.