Solved

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

Posted on 2008-10-17
3
939 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
ID: 22741749
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
ID: 22741755
sorry two errors. both the same
0
 

Accepted Solution

by:
netadmin2004 earned 0 total points
ID: 22741887
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the frequent problems with the installations is when some file or registry entry is not removed from the system upon un-installation of the product. Clean removal is always highly desirable. One major reason for that is badly authored inst…
One of the most frequently asked questions on EE in the "Windows Installer" zone is how to eliminate self-triggered installation of some product.  The problem occurs when, suddenly, whenever a certain application is launched, or even when a folder i…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

939 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