# startup script to launch .swf file

This is a discussion on startup script to launch .swf file within the C Programming forums, part of the General Programming Boards category; Hi, My friend wants to launch upon booting windows an .swf file he created by creating an .exe that basically ...

1. ## startup script to launch .swf file

Hi,
My friend wants to launch upon booting windows an .swf file he created by creating an .exe that basically says (launch whatever.swf in new window.) Is this something that can be done in C, or is it more along the lines of Windows shell scripting (something I know nothing about?) Thanks for any and all help.

2. .swf files aren't executable, and on my system, aren't associated with anything. What exactly are you wanting to do? Open it in a browser window?
If you want to open it in say, IE, you could create a shortcut and place it in the Startup folder in the start menu so it runs on boot. Make the target something like:
"C:\Program Files\Internet Explorer\Iexplore.exe" "Path\To\swf\file"

To do it in a program, you could call CreateProcess() / or ShellExecute()(?) and then place the program in the start menu. (But the shortcut seems easier...)

3. You mean like put the exe into the startup group ?

4. Well, he has about 7 swf files, so he wants to make it so upon startup the exe will launch a certain swf file; I believe a different one every day of the week. Salem, you are correct, he wants to put the exe into the startup group. I think you are right Cactus_Hugger, that unless you have Flash then .swf won't be associated with anything. HMMM...

5. Even with flash, .swf files don't get an association. (At least not on my box.) IE/Firefox/Your browser here will open them, however. The above shortcut does run the swf file, it runs IE, and instructs IE to open the .swf file. To change out depending on the day, you could either create an HTML file with some fancy javascript to print out the corresponding .swf, or use a program and launch the swf from there.
Code:
SYSTEMTIME stime;
char *filenames[] = {"Sunday.swf", "Monday.swf", "etc, etc" ... };

GetLocalTime(&stime);
CreateProcess("C:\\Program files\\Internet Explorer\\Iexplore.exe", filenames[stime.wDayOfWeek], NULL, NULL, FALSE, 0, NULL, "Path\\to\\swf\\files", NULL, NULL);
Didn't test that, but hopefully you get the idea. filenames should have 7 strings.
You can also make the current directory argument null and specify full filenames if that doesn't work. As always, read the manual.

6. Thanks Cactus_Hugger,
I think my friend is going to go the IE shortcut route, but thanks for the code snippet; I will test it out myself what the heck it could come in handy