Solved

Why would getabsolutepath run twice in this simple vbscript for an hta file?

Posted on 2008-10-17
3
938 Views
Last Modified: 2012-05-05
<HEAD>
  <TITLE>My Monster Application</TITLE>
  <HTA:APPLICATION ID="SLX_REMOTE_INSTALL"
    APPLICATIONNAME="SLX REMOTE INSTALL"
    BORDER="none"
    CAPTION="no"
    SHOWINTASKBAR="no"
    SINGLEINSTANCE="yes"
    SYSMENU="no"
    WINDOWSTATE="maximize">
   
<style type="text/css">
<!--
body { overflow:hidden; }
-->
</style>
   
    <script language="vbscript" type="text/vbscript">
    function Button1_onclick()
        Set objShell = CreateObject("Wscript.Shell")
        objShell.Run "setup.exe /S/v/qn"
        Set objShell = Nothing
    End Function

    function Button6_onclick()
        Dim objFS, sCurPath, runPath
        Set objFS = CreateObject("Scripting.FileSystemObject")
        sCurPath = objFS.GetAbsolutePathName("Nokia Intellisync")
        Set objShell2 = CreateObject("Wscript.Shell")
        runPath = sCurPath & "\setup.exe /S/v/qn "
        objShell2.Run runPath
        Set objShell2 = Nothing
        Set objFS = Nothing
    End Function

    function Button4_onclick()
        strComputer = "." ' Local Computer

        Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\" & _
            strComputer & "\root\cimv2")

        Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

        For Each objOS in colOS
              objOS.Reboot()
        Next
    End Function
    </script>
   
    <script language="javascript" type="text/javascript">        
    function RestoreWindowSize()    
    {      
    var width = 640;
    var height = 480;
    window.resizeTo(width, height);
    window.moveTo(parseInt((screen.availWidth/2) - (width/2)),parseInt((screen.availHeight/2) - (height/2)));
    }
   
    function Button3_onclick() {
        window.close();
        }
    </script>
        <style type="text/css">
            .style1
            {
                background-color: #FFFFFF;
            }
            .style2
            {
                font-weight: bold;
                background-color: #FFFFFF;
                height: 42px;
            }
            #Button1
            {
                width: 208px;
                height: 19px;
            }
            #Button2
            {
                width: 208px;
                height: 20px;
            }
            .style3
            {
                font-size: 15pt;
            }
            .style6
            {
                background-color: #FFFFFF;
                font-size: small;
                font-weight: bold;
                height: 49px;
            }
            #Button4
            {
                width: 208px;
                height: 20px;
            }
            .style8
            {
                font-size: 11pt;
                color: #2C438A;
                font-weight: bold;
            }
            #Button3
            {
                height: 19px;
            }
            .style9
            {
                background-color: #FFFFFF;
                font-size: small;
                font-weight: bold;
                height: 28px;
            }
            .style13
            {
                color: #2C438A;
                font-weight: bold;
            }
            .style14
            {
                background-color: #FFFFFF;
                height: 34px;
            }
            .style15
            {
                background-color: #FFFFFF;
                height: 32px;
            }
        </style>
</HEAD>
<body bgcolor="#ffffff" onload="RestoreWindowSize()" >
<center>
<font face='arial'>
<div id="layer1">
      <table style="background-color: #FFFFFF; height: 270px; width: 408px;">
            <tr><td class="style1"><img src="header_logofiserv.gif"></td></tr>
            <tr><td class="style2"><span class="style3">SalesLogix Remote Install</span><hr></td></tr>
            <tr><td class="style6">To install SalesLogix, please follow the steps below</td></tr>
            <tr><td bgcolor="#E0E0E0" class="style8">Step 1.) Install SalesLogix, please click below...</td></tr>
            <tr><td class="style14" title="Install SalesLogix">
            <input id="Button1" type="button" value="Click to install SalesLogix" onclick="Button1_onclick()" /></td></tr>
            <tr><td bgcolor="#E0E0E0">
<font face='arial'>
            <span class="style8">Step 2.) I</span><span class="style8">nstall Intellisync, please click below...</span></td></tr>
            <tr><td class="style15">
            <input id="Button6" type="button" value="Click to install Intellisync" onclick="Button6_onclick()" /></td></tr>
            <tr><td bgcolor="#E0E0E0">
            <span class="style8">Step 3.) Restart your computer...</span></td></tr>
            <tr><td class="style15">
<font face='arial'>
            <input id="Button4" type="button" value="Click to Restart Your Machine" onclick="Button4_onclick()" /></font></td></tr>
            <tr><td class="style1">
            &nbsp;</td></tr>
            <tr><td class="style1">
            <input id="Button3" type="button" value="Close Window" onclick="Button3_onclick()" /></td></tr>
      </table>
</div>
</font>
</center>
</body>
0
Comment
Question by:netadmin2004
  • 3
3 Comments
 

Author Comment

by:netadmin2004
Comment Utility
It's as if  function Button6_onclick() is running 2 times. I can't figure out why. I also get to error window pop ups

The actual file path is showing this:
D:\Nokia Intellisync\setup.exe /S/v/qn D:\Nokia Intellisync\setup.exe /S/v/qn

and not just

D:\Nokia Intellisync\setup.exe /S/v/qn
0
 

Author Comment

by:netadmin2004
Comment Utility
sorry two errors. both the same
0
 

Accepted Solution

by:
netadmin2004 earned 0 total points
Comment Utility
figured it out... the generated code for the script shows button_onclick... take the onclick out in the function and where the function is called...


Please close question
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
If you don't know how to downgrade, my instructions below should be helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now