Webview question....

What do i set the webview as to make my

open location

script to work? Is there a different way to do it? Right now i have it as “View - Bounds Changed”

Hi,

take a look at http://macscripter.net/viewtopic.php?id=22466

Any way of doing it without pressing a button? I saw this post… and kinda of ignored it because basically what i was needing, is i have the webview fill most of the window. When the person opens the application, it automatically goes to a certain website presented by a file. The file contains what link to go to. So when the user opens the application, the script reads what link to go to, then goes to it.

Of course, run the script in the awake from nib or will finish launching handler

:frowning: i don’t see how any of these would work, because it doesn’t seem like they would connect to the webview… :frowning: sorry

on launched theObject
	loadPage from "http://www.google.com/"
end launched
on loadPage from theURL
	
	set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
	set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
	tell window "window"
		set mainFrame to call method "mainFrame" of object (view "browser")
	end tell
	call method "loadRequest:" of mainFrame with parameter requestWithURL
end loadPage

Make sure you change the window name, and Make the WebView have the name of browser.

1 question… How do i make this work… It’s suppose to read the file, then use that as the web address.

set the_file to (((path to "dlib" from user domain as string) as text) & ".webim.ini") as file specification
set read_data to read the_file as text
on launched theObject
	display dialog read_data
end launched


on loadPage from theURL
	set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
	set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
	tell window "WebIM"
		set mainFrame to call method "mainFrame" of object (view "browser")
	end tell
	call method "loadRequest:" of mainFrame with parameter requestWithURL
end loadPage

try this


on launched theObject
	set the_file to ((path to library folder from user domain as text) & ".webim.ini")
	set read_data to read file the_file
	display dialog read_data
	loadPage from read_data
end launched


on loadPage from theURL
	set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
	set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
	tell window "WebIM"
		set mainFrame to call method "mainFrame" of object (view "browser")
	end tell
	call method "loadRequest:" of mainFrame with parameter requestWithURL
end loadPage