Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can flash run .vbs file?

Status
Not open for further replies.

janicefoo

Programmer
Apr 17, 2003
53
MY
Dear gurus and members,
I am very new in flash and scripting. I wonder whether can Flash run vbscript file? I have a flash button that is supposed to call a vbs file when user clicks on it on the browser. The button does not pass any value to the vbs file, just run the vbs. The vbs will execute an exe file. Is there any ways to work this out? Are there any restrictions for doing this, ie: placing the files under the same path/directory? I would be very appreciated if someone could share the expertise and knowledge in this matter. Any suggestions or sample codes are highly appreciated. Looking forward to some reply soon.

Thanks in advance,
Janice
 
You won't be able to run the vbs file directly from Flash in the browser but what you could do is use FSCommand or a getURL call from Flash to trigger a JavaScript function in the host HTML page which then talks with the VBScript.

I've never tried this directly but have successfully passed values from Flash via JavaScript to a VB ActiveX component in the same page before so maybe it will provide a workaround?
 
Thanks wangbar for the suggestion. Can you guide me by showing me the sample codes on how to go about this this? I know nothing about actionscript and javascript. I would very appreciate if you can show me the way. Hope to hear from you soon.

Thanks in advance,
Janice
 
I've never tried to do exactly what you're doing with the vbs so can't really help without doing research of my own. But the Flash talking to Javascript part is easy:

Code:
getURL("javascript:alert('Hello World!');");[code]

...is an example of using the 'alert' function in Javascript straight from Flash - to trigger your own custom function you can use the same syntax:

[code]getURL("javascript:yourFunction(parameters);");[code]
 
Thanks wangbar,
I wonder whether will this cause download save/open dialog box to pop up everytime the button is clicked. If yes, is there any methods to eliminate them? Looking forward to your reply soon.

Thanks in advance,
Janice
 
If you're just triggering a javascript function in your HTML page then the process should be invisible with no dialogs popping up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top