Solved

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

Posted on 2008-10-17
3
945 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

615 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