hey I’m now to appelscript and am a student who is doing his best to learn so any help would be greatly appreciated. I am trying to create simple app that has a webview. I have named the window main and the webveiw web. bellow is the code I’m entering.
property theUrl : "http://www.google.com"
on awake from nib theObject
if name of theObject is "web" then -- web view called web in IB
set theMethod to "stringByEvaluatingJavaScriptFromString:"
set theScript to "location.href='" & theUrl & "'"
call method theMethod of theObject with parameter theScript
end if
end awake from nib
I got going on this from an older post in this forum. Now, when I compile this code I get the bellow error and I can’t find any errors in the code Please help!!!
2004-10-28 20:56:51.597 webview1[545] An uncaught exception was raised
2004-10-28 20:56:51.598 webview1[545] *** class error for ‘WebView’: class not loaded
2004-10-28 20:56:51.598 webview1[545] *** Uncaught exception: *** class error for ‘WebView’: class not loaded
webview1 has exited due to signal 5 (SIGTRAP).
LIke I said I am a student and any help would be awsome.
Did you add support for the WebKit framework to your project? It looks like it is not recognizing the web view class. To add the webkit framework… in the Finder, navigate to “System/Library/Frameworks/WebKit.framework” and drag it into your project’s Groups & Files list. This will add support for all of the webkit classes and methods.
Here’s an alternative bit of code for loading a page into a web view…
on load_webpage(this_URL)
try
set URLWithString to call method "URLWithString:" of class "NSURL" with parameter this_URL
set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
set mainFrame to call method "mainFrame" of object (view "web" of window "main")
call method "loadRequest:" of mainFrame with parameter requestWithURL
on error the_error
log the_error
end try
end load_webpage
Hey I loaded the frame work but i am still getting errors.
they are as follows
2004-10-29 19:32:01.127 web[596] An uncaught exception was raised
2004-10-29 19:32:01.127 web[596] *** class error for ‘WebView’: class not loaded
2004-10-29 19:32:01.128 web[596] *** Uncaught exception: *** class error for ‘WebView’: class not loaded
web has exited due to signal 5 (SIGTRAP).
Juat wanted for thank you for your reply it was gretly appreciated. Does anyone else know what this error could mean?
I built and ran your project with no problems or errors. Have you tried cleaning your project (Build > Clean) and rebuilding? You may also have a corrupt project or nib, and being that you’re at such an early stage, you may want to start over with a new project.
Um… but now I have another quetion but it may not be possible. Is their any way I could set it up so that when they click on a link within the winow it launches their default web browser with the link they just selected?