Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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