hta doesn't work in after version 3


Recommended Posts

I was forced to upgrade to maxthon 4 but now the hta scripts will not run anymore. The functionality was working in Maxthon 3. How can I make this work again? I know it is an internet explorer thing but maxthon was the only browser I have found that was capable of running it. Now unfortunately this advantage seems to be lost.

 

 

post-485545-0-54131600-1432904888.png

Link to comment
Share on other sites

Hi,

 

Yes the script worked in MX3 but not in MX4. In MX3 it used the explorer mode in MX4 the proxy. I have added the script but it will not run completely in another environment as it needs data from different sources. I have a site where the users can click a link and then the correct database and version of a program is opened and used. This based on the script which is written in VBscript. I have set the file locations to XX\xx in the example hta and marked them red.

 

I guess it is the VBscript which is not handled correctly but the error message is that there is a incorrect syntax near e: which is not in the script so I'm a little bit lost here.

 

This is line 62

objRecordSet.Open SQLQry, objConnection, adOpenStatic, adLockOptimistic 

 

And the 9th char is the first 'o' of objRecordSet  

 

 

 

Start.hta 

 

<HTML>
  <HEAD>
    <TITLE>
      The Launcy Launcher
    </TITLE>
    
    <HTA:APPLICATION 
     APPLICATIONNAME="Quick Launcher"  
     MAXIMIZEBUTTON="no"
     MINIMIZEBUTTON="no"
     SINGLEINSTANCE="yes"
     SCROLL="no" />
  </HEAD>
  
  <BODY STYLE="FONT-FAMILY: Verdana; BACKGROUND-COLOR: #D2D2D2;" >
   
    <!-- Main display area.  The content of this area is controlled   -->
    <!-- by VBScript code                                             -->  
    
    <SCRIPT LANGUAGE="VBScript">
  
      ' This code is run on startup
      Call Main
 
     
      Sub Main
 
 
        'Dim the variables and set constants the only thing that needs to be changed is the ID constant which needs to be set to the identity of the row to start
        'ID = replace(Wscript.ScriptName,".hta","")
 
        dim objConnection, objRecordSet, SQLQry, objFile, objShell, strUserProfile, strServer, strNavPath, strServerPortNumber, strCompanyName, strClientLocation, strVersion, strStartFin, strDatabase, strZup, strLeading , strMessage
        Const adOpenStatic = 3
        Const adLockOptimistic = 3
        Const HEIGHT = 150
        Const WIDTH = 210
        
        ' Resize and center the window
        window.resizeTo WIDTH, HEIGHT
        window.moveTo (screen.width - HEIGHT) / 2, (screen.height - WIDTH) / 2
        
        'Define the SQL Query and create the objects
 
        Set objConnection = CreateObject("ADODB.Connection")
        Set objRecordSet = CreateObject("ADODB.Recordset")
        Set objFile = CreateObject("Scripting.FileSystemObject")
        Set objShell = CreateObject("wscript.Shell")
 
    urlString = document.url 'retrieve complete url
    bPos = Instr(1, urlString, "?id=", 1) + 4 'question mark (?) will determine if there is any query
 
 
if bPos > 1 Then
    ID = Mid(urlString, bPos, 3)
    End if      
 
SQLQry = "SELECT [NavisionClient].[CustomerName], [NavisionClient].[server], [NavisionClient].[isSQLServer], [NavisionClient].[serverPortNumber], [NavisionClient].[CompanyName], [FinClients].[ClientLocation], [FinClients].[Version], [NavisionClient].[DatabasePath], [NavisionClient].[Leading], [NavisionClient].[username]   FROM [NavisionClient] INNER JOIN [FinClients] ON [NavisionClient].[NavisionVersion] = [FinClients].[Version] where [identity] = " & ID 
 
        'Then we connect
 
        objConnection.Open "Provider=SQLOLEDB;Data Source=GIN;User Id=K3_Databases;Password=K3_Databases;;Initial Catalog=K3_Databases;" 
        objRecordSet.Open SQLQry, objConnection, adOpenStatic, adLockOptimistic
 
 
'And set variables to the fields from the record we just fetched (we only have one so we dont need to loop)
 
strServer = rtrim((objRecordSet.fields.item("Server")))
strNavPath = rtrim(objRecordSet.fields.item("IsSQLServer"))
strCompanyName = rtrim(objRecordSet.fields.item("CompanyName"))
strClientLocation = rtrim(objRecordSet.fields.item("ClientLocation"))
strVersion = rtrim(objRecordSet.fields.item("Version"))
strDatabase = rtrim(objRecordSet.fields.item("DatabasePath"))
strZup = replace(rtrim(objRecordSet.fields.item("CustomerName")),"/","")
strZup = replace(strZup,"\","")
  strZup = strZup & ID
 
 
strLeading = rtrim(objRecordSet.fields.item("Leading"))
strServerPortNumber = rtrim(objRecordSet.fields.item("ServerPortNumber"))
strUsername = rtrim((objRecordSet.fields.item("Username")))
 
'start RTC client
 
if InStr(lcase(strVersion) , "rtc") then
 
'create startupstring for RTC here
 
Dim strDriveLetter, strRemotePath
Dim objNetwork 
Dim CheckDrive, AlreadyConnected, intDrive 
' The section sets the variables. 
strDriveLetter = "S:" 
strRemotePath = "\\XX\xx\Software" 
 
Set objNetwork = CreateObject("WScript.Network") 
Set CheckDrive = objNetwork.EnumNetworkDrives() 
 
' This section deals with a For ... Next loop
' See how it compares the enumerated drive letters
' with strDriveLetter
On Error Resume Next
AlreadyConnected = False 
For intDrive = 0 To CheckDrive.Count - 1 Step 2 
If CheckDrive.Item(intDrive) =strDriveLetter _
Then AlreadyConnected =True
Next 
 
' This section uses the If = then, else logic
' This tests to see if the Drive is already mapped.
' If yes then disconnects
If AlreadyConnected = True then 
'objNetwork.RemoveNetworkDrive strDriveLetter 
'objNetwork.MapNetworkDrive strDriveLetter, strRemotePath 
 
' The first message box
' objShell.PopUp "Drive " & strDriveLetter & _
'"Disconnected, then connected successfully." 
Else
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath 
'objShell.PopUp "Drive " & strDriveLetter & _
'" connected successfully."
End if 
 
strNavPath = "Microsoft.Dynamics.Nav.Client.exe"
 
            strUserProfile = objShell.ExpandEnvironmentStrings("%programfiles(x86)%")
if objFile.FolderExists(strUserProfile &rtrim(strClientLocation)) then
strStartFin = (chr(34) &strUserProfile &rtrim(strClientLocation) &strNavPath &chr(34))
else
strUserProfile = objShell.ExpandEnvironmentStrings("%programfiles%")
if objFile.FolderExists(strUserProfile &rtrim(strClientLocation)) then
strStartFin = (chr(34) &strUserProfile &rtrim(strClientLocation) &strNavPath &chr(34))
'else we start it from "S:"
else 
strStartFin = (chr(34) & "S:\" &rtrim(strClientLocation) &strNavPath & chr(34))
end if
end if
 
strStartFin = (strStartFin &" -settings:" & "\\XX\XX\software\" &rtrim(strClientLocation) & "\RTCconfig\" & (strServer))
'objShell.Popup strStartFin, AUTO_DISMISS, "WARNING", OK_BUTTON
 
 
else 
' start classic client
'The following creates the navision startup path and parameters.
'Creating the path to the navision client
 
'Check if we should start fin.exe or finsql.exe and update the string
Select Case strNavPath
 case "False" strNavPath = "fin.exe"
 case "True" strNavPath = "finsql.exe"
 case "Onwaar" strNavPath = "fin.exe"
 case "Waar" strNavPath = "finsql.exe"
end select
 
'Check for startup path, if the navision client exist we will start them from the local hard drive
strUserProfile = objShell.ExpandEnvironmentStrings("%programfiles(x86)%")
if objFile.FolderExists(strUserProfile &rtrim(strClientLocation)) then
strStartFin = (chr(34) &strUserProfile &rtrim(strClientLocation) &strNavPath &chr(34))
else
strUserProfile = objShell.ExpandEnvironmentStrings("%programfiles%")
if objFile.FolderExists(strUserProfile &rtrim(strClientLocation)) then
strStartFin = (chr(34) &strUserProfile &rtrim(strClientLocation) &strNavPath &chr(34))
'else we start it from \\XX\xx\Software
else 
strStartFin = (chr(34) &"\\XX\xx\Software" &rtrim(strClientLocation) &strNavPath &chr(34))
end if
end if
 
'Append the database name if defined
If  ISNULL(strDatabase) Then
 'No Database, lets not do anything
Else
strStartFin = (strStartFin &"database="&(strDatabase) &",")
End If 
 
'Get the company name if defined
If ISNULL(strCompanyName)Then
 'One less thing to worry about
Else
 strStartFin = (strStartFin &" company="&(strCompanyName)&",")
end If 
 
'Set the zupfile
 
strStartFin = (strStartFin &" id="&(strZup)) 
 
'Set ntauthentication yes/no
 
If strUsername = "windows" Then
 strStartFin = (strStartFin &", ntauthentication=1,")
else
 strStartFin = (strStartFin &", ntauthentication=0,")
end If
 
'set the servername
if ISNULL (strServer) then
  ' No Server, Lets not do anything
Else
strStartFin = (strStartFin &" nettype=tcp, "&"servername="&strServer )   
end if
 
 
'append the port number to the servername if defined
If (strServerPortNumber) = "" OR ISNULL(strServerPortNumber) Then
 ' Dont worry be happy now
Else
 strStartFin = (strStartFin &":" &(strServerPortNumber))
end If 
 
'display warning
Const BUTTON = 48
Const AUTO_DISMISS = 0
Const CAPTION = "NON LEADING DATABASE"
 
If (strLeading) = "True" or (strLeading) = "Waar" Then
' Leading message if needed
' strMessage = "You are now opening a LEADING database."
' objShell.Popup strMessage, AUTO_DISMISS, "WARNING", OK_BUTTON
 
Else
' NON leading message
strMessage =  "You are opening a NON leading database." & vbcr & vbcr & "Don't forget to update the leading database if needed."
objShell.Popup strMessage, AUTO_DISMISS, CAPTION , BUTTON
end If 
        
 
end if
 
' control message
        ' strMessage =  strStartFin
' objShell.Popup strMessage, AUTO_DISMISS, CAPTION , BUTTON
 
' Start the Bastard
' objShell.Popup strStartFin, AUTO_DISMISS, CAPTION , BUTTON
objShell.Run (strStartFin)
 
'cleanup and exit
objRecordSet.Close
set objRecordSet = nothing
set objConnection = nothing
set SQLQry = nothing
set objFile = nothing
set objShell = nothing
set strUserProfile = nothing
set strServer = nothing
set strNavPath = nothing
set strServerPortNumber = nothing
set strCompanyName = nothing
set strClientLocation = nothing
set strStartFin = nothing
set strDatabase = nothing
set strZup = nothing
'Thats All folks
     
        
      End Sub
   
    set wscript = Nothing
    window.close       
    </SCRIPT>
    
  </BODY>
</HTML>
Link to comment
Share on other sites

Hi, anyway, could you provide us a full screenshot (which includes whole browser) also, it would be better if you can give us screenshots of the normal situation in other browsers like MX3, you can download MX3 in here   http://dl.maxthon.cn/mx3/maxthon_portable_3.5.2.1000.7z

since there is limited information, we can not  diagnose what the problem it is, we really wanna help you to solve it  but we need more information to reproduce . Many thanks.

Link to comment
Share on other sites

Hi,

 

I have reinstalled MX3 again as MX4 doesn't work in any off the mode and settings. 

 

I have documented the steps and have the start.hta if someone is interested. I just don't know how to attach documents to this forum. I tried to do it with pictures but I wasn't allowed by the forum to post it.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.