flashshared-objectslocal-shared-object

How can I programatically determine the location that Flash stores Local Shared Objects


I'm writing some automated acceptance tests for a flash movie (driving the movie using iMacros).

I need to "reset" the test environment before each test run by clearing out the settings flash is storing in Local Shared Objects.

I can do this manually by deleting the files in:

C:\Documents and Settings{username}\Application Data\Macromedia\Flash Player#SharedObjects\FQSTGCV7\{site-url}

Obviously I want to automate this deletion step; but I'm wondering how to determine the above path in a non machine specific way.

In .NET,

"C:\Documents and Settings{username}\Application Data\Macromedia\Flash Player#SharedObjects\" is clearly

    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                         @"Macromedia\Flash Player\#SharedObjects")

How do I figure out what "FQSTGCV7" will be on a different machine? Is there an environment variable? Is there only ever 1 directory below #SharedObjects\ ?

Thanks


Solution

  • I'm not sure how that series of characters are determined, however the fact that it always ends with the site-url leads me to believe a simple bit of regex/string matching should be able to do the job for you. Just look for a file that ends in your site's URL.

    In addition, it is possible to make a Flash movie flush it's own data by simply pushing empty data to the LSO. Also, by going into the settings menu of the Flash player you can flush all of the data by dialing the desired amount of space for LSOs down to 0, closing the settings, and then re-opening settings and dialing it back up to the default 100k. Neither of these may be applicable in your case, but they do come in handy.