flash files in applescript

ok is there a way i can view a flash (swf) file in an applescript. or is there a binary file i can load via do shell script?

Applescript itself is a language, and has no method or means by which to display anything. It does interact with applications and frameworks to allow you to access resources… such as swf files… through their respective interfaces. You could of course use an applescript to tell some application to open and display a flash file.

Can I assume that you mean ‘…in an Applescript Studio Project’? If so, then yes. Assuming that you have the swf plugin installed, a WebView can be put into your project, and that can display swf files. I know that classic versions of quicktime also could play swf files, but I’m not sure that a quicktime view can do that now in osx.

Huh? What binary file? Of the swf file or of something else that can display the swf file? You’ve lost me completely…:confused:

j

can you point me to a tutorial on how to use a view to display a file?

This has been covered in dozens of threads. Try a Search for “webview”

ok, i can use a webview to display a website, but how do i make it display a file?

Just have it load the URL of the file; for example, instead of http://www.somesite.com/somepage.html, have the webview load file:///Users/yourusername/Documents/thefile.swf. If you need the syntax for actually making the webview load things, a quick search for “webview” should turn up several methods for doing so.

thats wierd it doesnt work, this is what i put to do it

call method "stringByEvaluatingJavaScriptFromString:" of webView with parameter "location.href='file:///path/to/file/'"

and that doesnt work

As I recall, that method doesn’t work for regular files. Try this one by jobu:


set theURL to "file://Users/yourusername/Documents/thefile.swf"
set theWebView to view "webview" of window "main"
set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
set mainframe to call method "mainFrame" of object (theWebView)
call method "loadRequest:" of mainframe with parameter requestWithURL

This method doesn’t work with nonstandard characters, so if the file path may contain non-English letters (the ones with dots, squiggly lines, accents, etc. over them), you may be out of luck.