Mac Help Forums


Reply
Thread Tools Display Modes

Applescript Studio - How to...

 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      25th June 2005
Applescript Studio is a group of technologies that all work together to help you write your own software.

All are on you Panther or Tiger install CD or DVD. just copy over the developers tools folder.

Once you have loaded the developer tools, you can start building...

Launch, Xcode and select new project from the file menu (the screenshots are Tiger), then scroll down and for this example select "AppleScript Application". Fig 1.

Type in the project name as Fig 2, use whatever name you like ! Then press finish.

Don't worry we haven't really finished, we're just starting !

You should now have a project window, like Fig 3, (this is in Tiger).

I know....whoooaaaa....what's all this !!!

Don't worry it's not as bad as it looks...

...more tomorrow !
Attached Thumbnails
Applescript Studio - How to...-fig1.jpg   Applescript Studio - How to...-fig2.jpg   Applescript Studio - How to...-fig3.jpg  
 
Reply With Quote
 
 
 
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      26th June 2005
Three "files/folders" in the project window are important for this Test App.

The 'Scripts Folder' see Fig4, this folder will contain the "Applescripts" that we are going to write for this Application !

If you click on this folder and then double click on the Script you will see something like Fig5 this will be, where we enter our Applescript.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The next folder we are interested in, is the 'Resources Folder'. Within here, as you can see as in Fig6 it contains a file called 'MainMenu.nib'. This nib file will contain our graphical elements such as the menus and windows for our little App.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The third 'file' is the 'Application File' itself, in this example it's the one at the end in red in Fig7, "Ric's Test App.app". This file doesn't exist yet, not until we 'build' the App a bit later on.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The above are the basic building blocks that we are going to use to build our 'Applescript Studio App'. I am trying to keep this easy to follow and by doing so I am missing out some of the more technical aspects, but maybe we'll do a more complicated run through later !!!

more tomorrow...the fun bit, the interface builder !
Attached Thumbnails
Applescript Studio - How to...-fig5.jpg   Applescript Studio - How to...-fig6.jpg   Applescript Studio - How to...-fig7.jpg  
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      26th June 2005
Next: The Interface Builder.

Reopen your project from before, and double click the 'MainMenu.nib', Fig8.

The Interface builder App will open, three 'Windows' should open up, shuffle them around so that you can see what you are doing, and open the inspector window from the 'Tools' menu.
Attached Thumbnails
Applescript Studio - How to...-fig8.jpg   Applescript Studio - How to...-fig9.jpg   Applescript Studio - How to...-fig10.jpg  
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      26th June 2005
Have a look at the web browser that you are currently using, the 'Application itself' is a window...if you see what I mean. Every Application that you use is made up of Windows and Menus. This is what, in the simplest way, we have in front of us, in Interface builder.

We have a 'Main Window' and a 'Main Menu'.

WIMP....Windows ~ Icons ~ Menus ~ Pointer. Aqua is our GUI, Graphical User Interface of choice.

The three windows that have opened up should look like Fig11,12,13.
Attached Thumbnails
Applescript Studio - How to...-fig11.jpg   Applescript Studio - How to...-fig12.jpg   Applescript Studio - How to...-fig13.jpg  
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      26th June 2005
The 'Window' can be resized to whatever size you want, for this example we are going to make a small floating window.

If the 'Cocoa-xxxxx' palette isn't already open, go to the Tools menu > Palettes >Show Palettes.

This palette contains all the 'bits' that we will need to make our App. Have a click through the icons across the top to see the various palettes, and what each one contains. we are interested in the one with the buttons on, second from the left.

The first 'palettte' that we are interested in is the 'Cocoa-Controls' palette. Fig14.

Drag a button across to the 'Window', Fig15.

Make sure the button is selected, and change the button name in the Inspector Window Fig16, to 'Run Daily'

Now make three more buttons, 'Run Weekly', 'Run Monthly' and 'Run All'. As Fig17.

Notice I have now made the 'Main Window' much smaller, and how I have arranged the buttons.
Attached Thumbnails
Applescript Studio - How to...-fig14.jpg   Applescript Studio - How to...-fig15.jpg   Applescript Studio - How to...-fig16.jpg   Applescript Studio - How to...-fig17.jpg  
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      26th June 2005
As you dragged the buttons around, did you notice the guides ! They are very good for helping you align objects, so that everything looks nice.

It's starting to look a little more like an Application now.

Now we are going to add some text, and name the 'Main Window'. So that we end up with something like Fig18.
Attached Thumbnails
Applescript Studio - How to...-fig18.jpg  
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      26th June 2005
To add the text, in this instance we are adding 'uneditable' text.

Now we are using the third from the left 'palette' Cocoa Text, drag across the 'Label Font Text' as Fig19.

Now edit that text box with the text from Fig18 (previous post). You will need to create three text boxes to create it exactly as Fig18. One for the main text, one for the 'This is just..' and one for the web address.

You can colour the text as you would in any word processor, just select the text and change the colour via the 'Colors' palette > Tools Menu. You can also resize, align etc.

Now to change the 'Main Window' name, just click the window and make sure nothing within it is selected, now change it via the Inspector. Fig20.

When we get a bit more confident we will have a look at a few other 'thing' we can do ... whilst the Inpector is still on the 'Main Window' change the 'Has Texture' to ticked ! Fig21.

Now our little Application should look like Fig22.
Attached Thumbnails
Applescript Studio - How to...-fig19.jpg   Applescript Studio - How to...-fig20.jpg   Applescript Studio - How to...-fig21.jpg   Applescript Studio - How to...-fig22.jpg  
 
Reply With Quote
 
Senior Member
Danster's Avatar
Join Date: Feb 2005
Location: Liverpool, England
Posts: 267
 
      28th June 2005
Hi

I had a crack at making a currency converter by looking at what you did for the temperature script and came up with this.

Ps. it can't convert numbers with Decimal points in such as £15.80 so maybe you can have a look and see where I've gone wrong
Attached Files
File Type: sit UK Pound conversion..app.sit (17.2 KB, 295 views)

 
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      28th June 2005
Very good !
Code:
set text_returned to text_returned as real
Try this ! Your file was 'seeing the text entered' as an 'integer' and getting rid of the data after the decimal point

Lots of different way's of doing it, just need to allow AS to see the 'data' entered as a fraction/decimal.

Hope this helps.

Try pressing the control key and clicking in an open Script editor window and have a look at some of the scripts, they are very good for learning. Fig 3.
Attached Thumbnails
Applescript Studio - How to...-original.jpg   Applescript Studio - How to...-amended.jpg   Applescript Studio - How to...-fig3.jpg  
Attached Files
File Type: zip Original Applescript.zip (1.9 KB, 260 views)
File Type: zip Amended Applescript.zip (2.0 KB, 218 views)
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      28th June 2005
One for you to work on when we have finished the tutorial, more tomorrow. Wifey calls...
Attached Thumbnails
Applescript Studio - How to...-d.jpg  
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference to AppleScript Studio? Steffen Bendix AppleScript 5 8th July 2006 04:56 PM
Looking for an Applescript Studio suggestion Peter DuCharme AppleScript 1 27th June 2004 07:34 PM
Newbie with AppleScript Studio Lan AppleScript 0 21st January 2004 10:52 PM
10.3 AppleScript Studio numerous changes Simon Slavin AppleScript 3 21st November 2003 05:04 AM
'keyboard down' in AppleScript Studio Simon Slavin AppleScript 1 8th July 2003 07:55 AM


All times are GMT +1. The time now is 05:08 AM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
Help! Stupid computer is automatically logging me out
Elizaboo (6 Hours Ago, 10:41 PM)

URGENT Help. Crazy talk Mac!
Joeker (7 Hours Ago, 09:42 PM)

PDF Document
yura (16 Hours Ago, 12:13 PM)

Difficulties with internet speed (nothing to do with connection)
sammethh (22 Hours Ago, 06:36 AM)

Deleting a homepage/website form my mac book pro
rgandajg (1 Day Ago, 10:30 PM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51