Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

maximart4u

macrumors newbie
Original poster
Oct 12, 2008
26
0
Hey,

I'm attempting an application using Applescript in Xcode because I just can't get my head around objective-c.

So far I have a GUI with a button and a webview both linked to this code:

Code:
on clicked (theObject)
	if the name of theObject is "loadgoogle" then
		tell mainwindow
			open location "http://google.com"
		end tell
	end if
end clicked

It compiles fine but when I click the button nothing happens.

Could someone please enlighten me? :D

Kind Regards
 
I'm attempting an application using Applescript in Xcode because I just can't get my head around objective-c.

So far I have a GUI with a button and a webview both linked to this code:

Code:
on clicked (theObject)
	if the name of theObject is "loadgoogle" then
		tell mainwindow
			open location "http://google.com"
		end tell
	end if
end clicked

It compiles fine but when I click the button nothing happens.

Did you set the button to send a 'clicked' event to the script in Interface Builder? I forget exactly where (it's years since I used ASS), but there should be an AppleScript tab in the Inspector panel. GUI controls don't do anything unless you hook them up.

BTW, AppleScript Studio is deprecated in 10.6 (I'm guessing you're still on 10.5) and will eventually go away completely. Its much more powerful successor, AppleScriptObjC, provides a direct bridge to the Cocoa frameworks, so you probably will have to learn a bit of ObjC eventually (if only to make sense of the Cocoa documentation).

There was a recent thread on AppleScript users that discussed other GUI options which you may find useful, starting here:

http://lists.apple.com/archives/Applescript-users/2010/May/msg00210.html

HTH
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.