Flashfiles in Applescript Application

Hi Folks,

my chief wants me to attach a .swf File to my application! I have used the search button and found out, that webview might help…


	set theURL to ((path to me as Unicode text) & "Contents:Resources:view.swf") as file specification
	set theWebView to view "webview" of window "flash"
	set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
	display dialog "here3"
	set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
	display dialog "here4"
	set mainframe to call method "mainFrame" of object (theWebView)
	display dialog "here5"
	call method "loadRequest:" of mainframe with parameter requestWithURL
	display dialog "here6"

I have made a window called “flash” and put in a NSView “webview”! When running the Application, then the URLWithString will not be set - Error Message is showing a “Variable not definied”… The Variable “theURL” is set up correct! Maybe you have a hint how to solve this issue? How can I display a FlashMovie into a Applescript application…

Thanks a lot!

Stefan

Hi Folks,

the problem is with the Unicode text:

I have added/changed the following and got this result:


       set prefix to "file://"
	set file_name to ((path to me as Unicode text) & "Contents/Resources/view.swf") as file specification
	set theURL to prefix & file_name
	display dialog theURL

theURL= file://name:name:name:name:name

Does anybody knows how I get / instead of :?

Thanks for your reply

Stefan

Hi Stefan,

for a ‘/’-path use POSIX path of

I tried the following lines and it works for me - and yes, I tried loading some paths containing 'ä’s; 'ö's and 'ü’s … :wink:

set web to view "web" of window "main"
set swfURL to call method "fileURLWithPath:" of class "NSURL" with parameter (POSIX path of (choose file))
call method "loadRequest:" of (call method "mainFrame" of web) with parameter call method "requestWithURL:" of class "NSURLRequest" with parameter swfURL

D.

Hi Dominik,

thanks a lot! You are great! This works perfect!

Best Regards,

Stefan