How To Build An AppleScript-Based Cocoa-Application: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This page describes how you can build a simple [[AppleScript]] Application using XCode. | This page describes how you can build a simple [[AppleScript]] Application using XCode on Snow Leopard (10.6)<ref>This will NOT work on Leopard (10.5), a sample for Leopard will follow later...</ref>. | ||
== Creating a Wikipedia-Application<ref>just like [[5 Easy Steps To Your First RubyCocoa Application|this]]</ref> == | == Creating a Wikipedia-Application<ref>just like [[5 Easy Steps To Your First RubyCocoa Application|this]]</ref> == | ||
=== Creating the project === | === Creating the project === | ||
I used XCode 3.2.1 on Snow Leopard (10.6) | I used XCode 3.2.1 on Snow Leopard (10.6<ref>and this sample will ONLY work with 10.6! You can also do it with 10.5, but synthax is ''slightly'' different.</ref>) to create this project. | ||
==== Choose "New Project…" from File Menu ==== | ==== Choose "New Project…" from File Menu ==== | ||
Line 47: | Line 47: | ||
== More == | == More == | ||
== Finetuning == | === Finetuning === | ||
There is some of finetuning that you might want to consider: | There is some of finetuning that you might want to consider: | ||
* [[How to save the window position (cocoa)|Save the window position]] | * [[How to save the window position (cocoa)|Save the window position]] | ||
Line 58: | Line 58: | ||
---- | ---- | ||
* Stuff | * Stuff | ||
** Download the above Sample [[Media:AppleScriptCocoaSample.zip]] | |||
** Helpful links: | ** Helpful links: | ||
*** http://www.macosxautomation.com/applescript/develop/index.html (Please note that, as of now (2010-10-11), the downloadable project is missing the connections between the App Delegate and the UI Elements) | *** http://www.macosxautomation.com/applescript/develop/index.html (Please note that, as of now (2010-10-11), the downloadable project is missing the connections between the App Delegate and the UI Elements) | ||
Line 66: | Line 67: | ||
[[Category:AppleScript]] | [[Category:AppleScript]] | ||
[[Category:Development]] | |||
[[Category:Mac OS X]] |
Latest revision as of 10:36, 11 April 2024
This page describes how you can build a simple AppleScript Application using XCode on Snow Leopard (10.6)[1].
Creating a Wikipedia-Application[2]
Creating the project
I used XCode 3.2.1 on Snow Leopard (10.6[3]) to create this project.
Choose "New Project…" from File Menu
Choose "Cocoa-AppleScript Application" from Templates
Adding a Web View
Add an Outlet
property ourWebView : missing value (* This is an outlet to out WebView which we created in Interface Builder *)
Double-Click the Interface-File
As you can see, the outlet ourWebView is already visible in Interface Builder.
Search for WebView and drag it into your window
Resize the WebView to fill the window
Set Size-Settings for automatic resizing
Connect the Outlet to the WebView
Opening an URL
Tell the WebView to open an URL
Paste this...
tell ourWebView to setMainFrameURL_("http://www.wikipedia.org")
into the method applicationWillFinishLaunching_.
You made it!
Run the app and enjoy!
More
Finetuning
There is some of finetuning that you might want to consider:
- Save the window position
- Create and set an application icon
- Set version information and copyright
- Customize about box
- Add custom behaviour, e.g. creating an PDF from an web page, or saving bookmarks...
- Adding buttons for something you want to (paste text, translate text, look word up in Dictionary...)
- Stuff
- Download the above Sample Media:AppleScriptCocoaSample.zip
- Helpful links:
- http://www.macosxautomation.com/applescript/develop/index.html (Please note that, as of now (2010-10-11), the downloadable project is missing the connections between the App Delegate and the UI Elements)
- You might also be interested in the same thing done with Ruby: 5 Easy Steps To Your First RubyCocoa Application
- Short link to here: http://wurst-wasser.net/t/r.php?u=ASCocoaHow2
- Footnotes: