Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating a BAT file from a HTA
How can I execute a '.bat' file from the below HTM?
________________________________________________ <HTML <HEAD <TITLETest Button Events</TITLE </HEAD <BODY <FORM NAME="Form1" <INPUT TYPE="Button" NAME="Button1" VALUE="Click" <SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript" ...(How?)...cmd.exe "C:\Test.bat"...(How?)... </SCRIPT </FORM </BODY </HTML ________________________________________________ Thanks a million! -- Edmund (Using Excel XP) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating a BAT file from a HTA
I'm just trying to lauch the bat file when user click the button they see in
Internet Explorer. My "Test.bat" file contains only te below 2 lines: __________________________________________ prompt off "C:\Test\LaunchSub.vbs" "Apple" "Banana" __________________________________________ Fyi, this question is actually related to my earlier post entitled "Passing argument from cmd.exe to Excel VBA". I'm trying to achieve this: In IE, when user press the button, it will trigger 'Test.bat' to launch. This will inturn trigger 2 arguments be passed from "C:\Test\LaunchSub.vbs" "Apple" "Banana" to Excel VBA. Thanks a million! -- Edmund (Using Excel XP) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating a BAT file from a HTA
"Edmund" wrote:
I'm just trying to lauch the bat file when user click the button they see in Internet Explorer. My "Test.bat" file contains only te below 2 lines: __________________________________________ prompt off "C:\Test\LaunchSub.vbs" "Apple" "Banana" __________________________________________ Fyi, this question is actually related to my earlier post entitled "Passing argument from cmd.exe to Excel VBA". I'm trying to achieve this: In IE, when user press the button, it will trigger 'Test.bat' to launch. This will inturn trigger 2 arguments be passed from "C:\Test\LaunchSub.vbs" "Apple" "Banana" to Excel VBA. Thanks a million! -- Edmund (Using Excel XP) This will work in HTAs, but in a HTML page you may receive a security warning: <HTML <HEAD <TITLETest Button Events</TITLE </HEAD <BODY <FORM NAME="Form1" <INPUT TYPE="Button" NAME="Button1" VALUE="Click" <SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript" Set WshShell = CreateObject("WScript.Shell") WshShell.Run "cmd.exe 'C:\Test.bat'" </SCRIPT </FORM </BODY </HTML -- urkec |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating a BAT file from a HTA
cmd.exe did launch but seems the Test.bat file did not run. I'm unfamiliar
with commands related to cmd.exe & is clueless in troubleshooting your suggestion of adding ..... Set WshShell = CreateObject("WScript.Shell") WshShell.Run "cmd.exe 'C:\Test.bat'" If there's any URL to read, pls direct me there. Thanks again for any help. -- Edmund (Using Excel XP) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating a BAT file from a HTA
"Edmund" wrote:
cmd.exe did launch but seems the Test.bat file did not run. I'm unfamiliar with commands related to cmd.exe & is clueless in troubleshooting your suggestion of adding ..... Set WshShell = CreateObject("WScript.Shell") WshShell.Run "cmd.exe 'C:\Test.bat'" If there's any URL to read, pls direct me there. Thanks again for any help. -- Edmund (Using Excel XP) You could add /k to keep Command Prompt open after executing Test.bat, so you can see if there are any error messages. Set WshShell = CreateObject("WScript.Shell") WshShell.Run "cmd.exe /k C:\Test.bat" For help on commands type HELP or HELP command-name (like HELP CMD) in Command Prompt. -- urkec |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating a BAT file from a HTA
You may also want to want to look at a commercial product: HtmlApp
Studio Professional (http://www.htmlapp.com). I believe the Wsh solution always shows the batch file. HtmlApp Studio Professional allows you to make the batch file either visible or invisible. There are other features you may find of use beyond just solving your immediate problem. After download, look in the Help file under Help Browse User Manual Server Run time Interface Run External Programs or use the shortcut http://127.0.0.1:31993/userref.py?fo...ic&match=9.5.6 (when Html App Studio is running) for documentation. My name, email, and phone number are shown on the contact us page so don't hesitate to contact me if you run into any difficulties. Regards, Dennis DAIR Computer Systems |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Activating Workbooks | Excel Discussion (Misc queries) | |||
Activating an open file with a variable name | Excel Programming | |||
Activating cell in a file | Excel Discussion (Misc queries) | |||
Activating/De-activating buttons | Excel Programming | |||
opening or activating another workbook file | Excel Programming |