Tabbed Web Browser

Discussion in 'AppleScript Studio' started by George Washington, Sep 24, 2007.

  1. George Washington

    George Washington New Member

    Joined:
    Sep 24, 2007
    Messages:
    1
    Likes Received:
    0
    I'm trying to open web pages with WebView. I have no problems doing that. But when I try to open up WebView in Tab View, it doesn't work. I want to be able to open up multiple web pages and be able to go back and forth between them with tabs.

    Here's what I have.

    Code:
    on clicked theObject
    	GetURL()
    end clicked
    
    on end editing theObject
    	GetURL()
    end end editing
    
    on GetURL()
    	
    	tell tab view 1 of window 1
    		set theURL to "http://www.google.com" as text
    		
    		try
    			set newString to (call method "stringByAddingPercentEscapesUsingEncoding:" of theURL with parameter 30)
    			set URLWithString to call method "URLWithString:" of class "NSURL" with parameter newString
    			set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
    			set mainFrame to call method "mainFrame" of object (view "browser1" of tab view item "tab1")
    			
    			call method "loadRequest:" of mainFrame with parameter requestWithURL
    			
    		end try
    	end tell
    end GetURL
    
    Because I've been able to get WebView to work when it's not in the NSTabView, and because I've been able to get NSTabView to work when I'm just working with something simple like Text Field boxes, I know my problem must have something to do with the way I'm referencing my WebView in the Tab View. I've tried everything, and suggestions?
     
    George Washington, Sep 24, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.