Solved

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

Posted on 2008-10-17
3
941 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

778 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