Applescript Studio Problems, Web Browser

Discussion in 'Mac Programming' started by maximart4u, May 31, 2010.

  1. maximart4u macrumors newbie

    Joined:
    Oct 12, 2008
    #1
    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
     
  2. hhas macrumors regular

    Joined:
    Oct 15, 2007
    #2
    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
     

Share This Page