I looked high and low for a way to create a full screen mode from an Applescript Studio application. I didn't find one, but I did learn enough to create one ... read the rest of the hint for the code snippets.
Add the following two files to your project:
Fullscreen.h:
#import #import @interface NSApplication (ASKAFullScreen) - (NSWindow *)beginFullScreen; - (void)endFullScreen; @endFullscreen.mm:
#import "FullScreen.h"
NSWindow *fsWindow;
@implementation NSApplication (ASKAFullScreen)
- (NSWindow *)beginFullScreen
{ fsWindow = [
[NSWindow alloc]
initWithContentRect:[[NSScreen mainScreen] frame]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
NSView *fsView=[[NSView alloc] initWithFrame:[fsWindow frame]];
[fsWindow setContentView:fsView];
NSImageView *fsImage = [[NSImageView alloc] initWithFrame:[fsView frame]];
[fsView addSubview:fsImage];
[fsWindow setBackgroundColor:[NSColor blackColor]];
[NSMenu setMenuBarVisible:0];
[fsWindow makeKeyAndOrderFront:fsWindow];
return fsWindow;
}
- (void)endFullScreen
{ [NSMenu setMenuBarVisible:1];
[fsWindow close];
}
@end
Then you can use applescript to open and close the fullscreen window:
set theWindow to (call method "beginFullScreen") call method "endFullScreen"I hope someone else gets some use out of this example.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20030804193518188