Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activating Workbooks Sungibungi Excel Discussion (Misc queries) 2 June 5th 09 04:22 AM
Activating an open file with a variable name Andyjim Excel Programming 4 December 21st 07 06:32 PM
Activating cell in a file Roger Excel Discussion (Misc queries) 2 July 7th 05 10:52 PM
Activating/De-activating buttons Nash Excel Programming 4 June 22nd 05 07:24 AM
opening or activating another workbook file Paul James[_4_] Excel Programming 8 January 2nd 04 12:37 AM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"