MAC

Resize Your Windows Automatically for Different Resolutions MAC os x

tell application “Finder”
set desktopFrame to bounds of window of desktop
set screenHeight to item 4 of desktopFrame
end tell

tell application “System Events”
set activeApplication to name of the first process whose frontmost is true
end tell

tell application activeApplication
set appFrame to bounds of the first window
set xpos to item 1 of appFrame
set ypos to 0
set width to item 3 of appFrame
set height to screenHeight
set bounds of the first window to {xpos, ypos, width, height}
end tell

try
tell application “iTunes”
activate
set the bounds of the first window to {xpos, ypos, width, height}
end tell
end try

Mouse click event using Apple Script

set “Google” as Home page for test this application…

tell application “Safari”
activate
tell application “Safari”
run
tell application “System Events”
tell process “Safari”
click at {50, 100}
end tell
end tell
end tell
end tell

System tray menu in MAC OS x application

1. Open interface builder create NSMenu from Tools->Library. And create NSMenuItem “Active” and “Quit”.
2. “Active” select “Sent Action” -> “Window Server” and select “deminiature” action.
3. “Quit” select “Sent Action” -> “Application” and select “terminate” action.
4. “Menu” select “Outlet” ->ServerControll (applcation name control)
5. In “ServerController.h” file
IBOutlet NSMenu *menu;
NSStatusItem *statusItem;
NSImage *statusImage;
NSImage *statusHightlightImage;
6. In “ServerController.m” file
//Used to detect where our files are
NSBundle *bundle = [NSBundle mainBundle];
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];
[statusItem setEnabled:YES];
[statusItem setMenu:menu];
[statusItem setHighlightMode:YES];
[statusItem setToolTip:@”KB Keys”];
statusImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@”appicon” ofType:@”png”]];
[statusItem setImage:statusImage];
statusHightlightImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@”hoverappicon” ofType:@”png”]];
[statusItem setHighlightMode:YES];
[statusItem setAlternateImage:statusHightlightImage];