# Opening a file with a button

**URL:** <https://forum.kirupa.com/t/opening-a-file-with-a-button/22677>\
**Category:** flash\
**Created:** [June 6, 2003, 10:55pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677 "2003-06-06T22:55:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daveo123](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@Daveo123](https://forum.kirupa.com/u/Daveo123)\
**Post date:** [June 6, 2003, 10:55pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/1 "2003-06-06T22:55:36Z")

</div>

I haven’t for the life of me been able to figure out how to open a file (Non .exe or .swf) with a button from a movie.

Here’s the scenario, I need to open a PDF file by clicking on a button. GetURL won’t do it even if the browser is set to open PDF’s with a plug-in. As far as I can tell FSCommand will only open executables.

HELP!

Thanks,  
Dave…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 8, 2003, 1:14pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/2 "2003-06-08T13:14:07Z")

</div>

I did something like this before, you need to use fscommand to open a .bat file which will open the .PDF file, ill go and look at my file and post back.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 8, 2003, 1:21pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/3 "2003-06-08T13:21:22Z")

</div>

You need a button with [AS] on(release){  
fscommand(“Exec”,“filename.bat”);  
}  
[/AS]  
Then open notepad and type in the following \* START filename.pdf\* Then go to save as and type in a file name then _.bat_

**N.B** make sure the file that the flash button is opening it is the same name as your _.bat_ file. They both have to be in the same directory.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 8, 2003, 5:21pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/4 "2003-06-08T17:21:57Z")

</div>

Thank you so much for your response, it works like a charm!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 8, 2003, 8:22pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/5 "2003-06-08T20:22:37Z")

</div>

Thats ok Daveo123 im happy to help

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 10, 2003, 5:11am UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/6 "2003-06-10T05:11:27Z")

</div>

just refreshing this issue,

In my learnings, i have come across this issue, is it possible to do a check for Macintosh or PC, ie, if ur on a mac, open this file, if ur on a pc, open this other file. i know javascript can redirect?.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 10, 2003, 5:28am UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/7 "2003-06-10T05:28:18Z")

</div>

```auto
getPlatform = function () {
	var ver = System.capabilities.version;
	return ver.substr(0, ver.indexOf(" "));
};
trace(getPlatform()); // returns WIN/MAC/whatever

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 10, 2003, 6:06am UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/8 "2003-06-10T06:06:26Z")

</div>

Kx, u r a legend!

Thanks! =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 10, 2003, 6:11am UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/9 "2003-06-10T06:11:06Z")

</div>

😛

you’re welcome. 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 10, 2003, 2:24pm UTC](https://forum.kirupa.com/t/opening-a-file-with-a-button/22677/10 "2003-06-10T14:24:53Z")

</div>

That’s useful 🙂 Can someone please rate this?
