Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


HTA RUN EXE and all that jazz

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,23657
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> HTA RUN EXE and all that jazz
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 HTA RUN EXE and all that jazz - 7/15/2005 1:44:30 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Hiya all,

I just cannot get the following to work:


      

The following error appears after clicking the link:
"Object doesn't support this property or method"

What am i missing?

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com
 
 
Post #: 1
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 2:11:27 AM   
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
Inside of an HTA, between the <script> tags, there's no need to use:
<!-- or //-->

Just use
<script language="VBScript"> 
Set objShell = CreateObject("Wscript.Shell")

Sub runAppSound
objShell.Run "../sfw/Realtek AC97/SP26412.exe"
End Sub 
</script>

I haven't tried it that exact way. Generally I'll run my executibles by calling it through a command window.

SPEXE =  "../sfw/Realtek AC97/SP26412.exe"

Set objExec = objShell.Exec("cmd /c " SPEXE)

Hope that helps.

(in reply to Snipah)
 
 
Post #: 2
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 2:24:55 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
quote:

ORIGINAL: Country73

Inside of an HTA, between the <script> tags, there's no need to use:
<!-- or //-->

Just use
<script language="VBScript"> 
Set objShell = CreateObject("Wscript.Shell")

Sub runAppSound
objShell.Run "../sfw/Realtek AC97/SP26412.exe"
End Sub 
</script>

I haven't tried it that exact way. Generally I'll run my executibles by calling it through a command window.

SPEXE =  "../sfw/Realtek AC97/SP26412.exe"

Set objExec = objShell.Exec("cmd /c " SPEXE)

Hope that helps.


Sorry it didn't help

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to Country73)
 
 
Post #: 3
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 2:28:57 AM   
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
Are you actually giving the full path to "../sfw/Realteck AC97/SP26412.exe" ?

One thing I did just notice is the spaces in the name. You may need to just add the extra quotes or the chr(34).

(in reply to Snipah)
 
 
Post #: 4
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 2:37:03 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
no i don't use a full path, because this HTA has to be run from a CD-Rom

I changed the spaces into non--spaces and renamed the folder, but nope......

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to Country73)
 
 
Post #: 5
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 2:43:02 AM   
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
I know I've got an HTA that's similar to what you're trying to create (only just started creating HTA's), as soon as I get a chance to locate one I'll post it out here for you to try out.



So the executible you're trying to run, is it also located on the CD?

< Message edited by Country73 -- 7/15/2005 2:56:55 AM >

(in reply to Snipah)
 
 
Post #: 6
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 3:22:47 AM   
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
Ok, this one runs off of the PSSERVICE.EXE (www.sysinternals.com)
Which should be similar to how you're calling the SP26412.exe
'=====================================================

<HTML>
<HEAD>
<TITLE>Stop / Start Service</TITLE>
   <HTA:APPLICATION ID="oHTA"
    APPLICATIONNAME="StartStopService"
    BORDER="thin"
    BORDERSTYLE="normal"
    CAPTION="yes"
    ICON=""
    NAVIGABLE="yes"
    MAXIMIZEBUTTON="yes"
    MINIMIZEBUTTON="yes"
    SHOWINTASKBAR="no"
    SINGLEINSTANCE="yes"
    SYSMENU="yes"
    VERSION="1.0"
    WINDOWSTATE="maximize">

<SCRIPT LANGUAGE="VBScript">
Dim oShell,PSS,QUE,STO,STA
Set oShell = CreateObject("Wscript.Shell")
PSS = "File\psservice.exe "
QUE = " query -s "
STO = " stop "
STA = " start "

Sub whatService
If ComputerOption(0).Checked Then
   checkProcess
End If
If ComputerOption(1).Checked Then
   stopProcess
End If
If ComputerOption(2).Checked Then
   startProcess
End If
If ComputerOption(3).Checked Then
   stopProcess
End If
End Sub

Sub checkProcess
strPC = "\\" & TextBox0.value
strService = TextBox1.value
strRun = QUE
Set oExec = oShell.Exec("cmd /c " & PSS & strPC & strRun & strService)
 Do While Not oExec.StdOut.Atendofstream
   myInfo = oExec.StdOut.ReadLine
   If InStr(myInfo,"STATE") Then
     var1 = Split(myInfo,":")
     var2 = Len(var1(1))
     myNewInfo = Mid(var1(1),3,var2)
     strHTML = "<b>" & strPC & "<br>" & myNewInfo & "<br>"
     DataArea.innerHTML = strHTML
    End If
 Loop
End sub

Sub stopProcess
strPC = "\\" & TextBox0.value
strService = TextBox1.value
strRun = STO
msg = "Stopping"
If ComputerOption(3).Checked Then
 newOp = 1
Else
 newOp = 0
End If
Set oShell = CreateObject("Wscript.Shell")
 oShell.Exec("cmd /c " & PSS & strPC & strRun & chr(34) & strService & chr(34))
  If newOp = 1 Then
   iTimerID = window.setTimeout("startProcess",3000)
  Else
   iTimerID = window.setTimeout("checkProcess",3000)
  End If
 strHTML = "<b>" & strPC & "<br>" & msg & " " & strService & "</b><br>Please wait..."
 DataArea.InnerHTML = strHTML
End Sub

Sub startProcess
strPC = "\\" & TextBox0.value
strService = TextBox1.value
strRun = STA
If ComputerOption(3).Checked Then
 newOp = 1
 msg = "Restarting"
Else
 newOp = 0
 msg = "Starting"
End If
Set oShell = CreateObject("Wscript.Shell")
 oShell.Exec("cmd /c " & PSS & strPC & strRun & chr(34) & strService & chr(34))
  iTimerID = window.setTimeout("checkProcess",3000)
 strHTML = "<b>" & strPC & "<br>" & msg & " " & strService & "</b><br>Please wait..."
 DataArea.InnerHTML = strHTML
End Sub  

Sub bodyLoaded()
window.ResizeTo 650,400 ' WIDTH, HEIGHT
TextBox0.Focus()
End Sub
</SCRIPT>

</HEAD>
<body onLoad="bodyLoaded()" STYLE="font:13 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='black', EndColorStr='red')">
<h2>Accessing Remote Service</h2>
<table width="89" border="0" align="left">
<tr><td width="89"><span class="style5">*</span><b>NetBios: </b></td>
<td width="89"><input type="text" name="TextBox0"></td></tr>
<tr><td width="89"><span class="style5">*</span><b>Service: </b></td>
<td width="89"><input type="text" name="TextBox1" value="Print Spooler"></td></tr>
<tr><td width="89"><input type="radio" name="ComputerOption" value=QUE>Check_Service</td></tr>
<tr><td width="89"><input type="radio" name="ComputerOption" value=STO>Stop_Service</td></tr>
<tr><td width="89"><input type="radio" name="ComputerOption" value=STA>Start_Service</td></tr>
<tr><td width="89"><input type="radio" name="ComputerOption" value=RST checked><b>RESTART_Service</b></td></tr>
<tr><td width="89"><input id=SUBMIT class="button" type="button" value="Run" name="ok_button" onClick="whatService"></td></tr>
<tr><td width="89"><input type="button" value="     Exit     " name="close_button" onClick="Self.Close"></td></tr>
</td></table></p>
<br>
<br>
<br>
<br>
<br>
<br>
<span id = "DataArea"></span>
<!-- Insert HTML here -->
</BODY>
</HTML>

(in reply to Snipah)
 
 
Post #: 7
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 3:45:02 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Nope that didn't work.

What i did to solve it was:


Option Explicit
Dim objShell
Set objShell = CreateObject("Wscript.Shell")

Sub runAppSound_onClick()
objShell.Run "..\sfw\RealtekAC97\SP26412.exe",1,1
End Sub

...

<input type=button name="runAppSound" value="Geluidskaart: Audiodriverupdate voor Realtek AC'97">



I only have to make the button fancy with CSS, but that is no prob........ too bad that the other one didn't work though....

Thx Country73


--- edit:  the [ code ] doesn't work sorry, yo....

< Message edited by Snipah -- 7/15/2005 7:22:17 AM >


_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to Country73)
 
 
Post #: 8
 
 RE: HTA RUN EXE and all that jazz - 7/15/2005 7:32:53 AM   
  dogboyaa

 

Posts: 26
Score: 0
Joined: 12/20/2004
From:
Status: offline
If you couldnt get it to run try this:

Dim fso, WshShell
Set WshShell = CreateObject("WScript.Shell")
currDir = CreateObject("WScript.Shell").CurrentDirectory
       WshShell.Run currDir & "\sfw\RealtekAC97\SP26412.exe",1,1

It worked for me.

(in reply to Snipah)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> HTA RUN EXE and all that jazz Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts