Set file association for SWF with browser

msw
Contributor

Hello all-

I have been banging my head against the wall trying to get .swf (flash) files to associate with a browser via a policy — I was initially trying to associate with Chrome, but if I can associate with Safari, that's also fine (all machines in question have both installed). The end goal is to have the .swf in the applications folder, available for use offline as though it's a local app. Here's what I've tried so far that hasn't worked:

  1. Create .dmg with Composer created by dragging .swf to Applications folder, Get Info > Set to open with Chrome > click 'Change all'; enable FEU

  2. Create .pkg with Composer created by dragging .swf to Applications folder, then run this script (via http://stackoverflow.com/questions/9172226/how-to-set-default-application-for-specific-file-types-in-mac-os-x):

    sudo defaults write com.apple.LaunchServices LSHandlers -array-add "<dict><key>LSHandlerContentTag</key><string>swf</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key<string>com.google.Chrome</string></dict>" /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

This script is supposed to add an entry to com.apple.LaunchServices and then restart that service.

  1. Same as number 2, but with this syntax for the script

    sudo defaults write com.apple.LaunchServices LSHandlers -array-add '{"LSHandlerContentTag" = "swf"; "LSHandlerContentTagClass" = "public.filename-extensions"; "LSHandlerRoleAll" = "com.google.Chrome"; }' /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
  2. Create an Applescript with the following syntax (via http://stackoverflow.com/questions/9172226/how-to-set-default-application-for-specific-file-types-in-mac-os-x):

    set theFile to "/Applications/Online Stopwatch.swf"
    set myApp to alias "/Macintosh HD/Applications/Google Chrome.app"

    tell application "System Events" to set default application of file theFile to myApp

    I also have been doing some background reading
    http://apple.stackexchange.com/questions/50004/why-is-a-command-line-change-to-library-preferences-com-apple-launchservices-p
    http://superuser.com/questions/273756/how-to-change-default-app-for-all-files-of-particular-file-type-through-terminal

    etc. etc. etc.

    Anyone had any luck doing this or anything like it in the past? To restate, my only goal is to be able to push out a .swf file, and have the computer know an application to associate it with, without being set by the user.

    Thanks!

0 REPLIES 0