Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Fri, 2 May 2008 21:51:00 -0700,    group: microsoft.public.inetsdk.programming.scripting.vbscript        back       


HTA error in Windows Vista   
Hi,

Since a few weeks I have a new PC (Acer Aspire M3610) with Windows Vista 
Home Premium installed. I work from home for a jobsite and use a 
.hta-application - a toolbar - to manage e-mail and backoffice database stuff.

In XP this all worked fine, but in Vista I get errors. Starting the toolbar 
and logging in to it works fine, but when I click on a link to start a 
function (e.g. E-mail or Candidatemanagement) I get the following error:

"HTA Error: Exception occured while calling htaLoadandRun()"

sometimes also (and I hope my translation is not to far off):

"Automatic server can't create object"

I searched high and low, tried changing many settings (and back) in 
Firewall, user specific licenses(?) etc. Called supportdesk of the used app 
and wrote to Acer. And I still come up empty.

Anyone with a hint of an answer to solve this problem?

Thanks in advance!
-- 
Egbert van den Bosch
date: Fri, 2 May 2008 21:51:00 -0700   author:   Egbert van den Bosch

Re: HTA error in Windows Vista   
"Egbert van den Bosch"  wrote 
in message news:81CBCB3A-A192-4C74-9A99-722373340E09@microsoft.com...
> Hi,
>
> Since a few weeks I have a new PC (Acer Aspire M3610) with Windows Vista
> Home Premium installed. I work from home for a jobsite and use a
> .hta-application - a toolbar - to manage e-mail and backoffice database 
> stuff.
>
> In XP this all worked fine, but in Vista I get errors. Starting the 
> toolbar
> and logging in to it works fine, but when I click on a link to start a
> function (e.g. E-mail or Candidatemanagement) I get the following error:
>
> "HTA Error: Exception occured while calling htaLoadandRun()"
>
> sometimes also (and I hope my translation is not to far off):
>
> "Automatic server can't create object"
>
> I searched high and low, tried changing many settings (and back) in
> Firewall, user specific licenses(?) etc. Called supportdesk of the used 
> app
> and wrote to Acer. And I still come up empty.
>
> Anyone with a hint of an answer to solve this problem?
>
> Thanks in advance!
> -- 
> Egbert van den Bosch
It possibly uses a library not available in Vista. What code executes in the 
loadAndRun function?

-- 

Joe Fawcett (MVP - XML)
http://joe.fawcett.name
date: Sun, 4 May 2008 09:29:20 +0100   author:   Joe Fawcett am

Re: HTA error in Windows Vista   
Hi Joe,

Thanks for your time. I hope I can give you the right answer, but honestly, 
I'm not sure if this is what you mean:

The file I execute is called Otys.exe (the toolbar). In the 
User-MyName-Appdata-Local-Temp Folder there are two files created called 
Actions.xml and Otys.hta.
The code in the first file (Actions.xml) reads:
<?xml version="1.0" encoding="ISO-8859-1"?>
<actionlist>
</actionlist>
                  
The code in the second file (Otys.hta) reads:
<html>
<head>
<title>Today</title>

<HTA:APPLICATION ID="appOtysToolbar"
APPLICATIONNAME="OTYS"
BORDER="thick"
CAPTION="yes"
ICON="http://bo02.otys.nl/favicon.ico"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
CONTEXTMENU="no"
SYSMENU="yes"
SCROLL="no"
NAVIGABLE="no"
MaximizeButton="No"
WINDOWSTATE="normal">
</head>

<script language="JavaScript" 
src="http://bo02.otys.nl/adm/hta/java/hta.js"></script>
<script language="JavaScript" 
src="http://bo02.otys.nl/adm/hta/java/htasupport.js"></script>

<script language="Javascript">

// reset window size
//window.resizeTo(180,260);
window.resizeTo(360,520);

function start() {
    
    
    
    
document.getElementById('mainfrm').src='http://85.112.17.60/adm/hta/toolbar/toolbarhta.php?OTYS_BACKOFFICE='+htasGetSessionId(appOtysToolbar);
}

</script>

<body style="margin:0px;overflow:hidden;" onLoad="start()">


<script language="Jscript">
    // registry hacks here:
    try {
        var shell = new ActiveXObject('WScript.Shell');
        
shell.RegWrite('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\otys.nl\\bo01\\*',2,"REG_DWORD");

        
shell.RegWrite('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\*',2,"REG_DWORD");
        
shell.RegWrite('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\:Range','85.112.17.60');
        shell.RegWrite('HKEY_CURRENT_USER\\Software\\Microsoft\\Internet 
Explorer\\New Windows\\Allow\\85.112.17.60','hex:');
        // set MSIE default caching to AUTOMATIC (4)
        
shell.RegWrite('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\SyncMode5', 4, "REG_DWORD");
        // enable advanced cookie handling
        
shell.RegWrite('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\PrivacyAdvanced', 1, "REG_DWORD");
    } catch (e) {
        alert('Warning: unable to setup registry settings');
    }
    
</script>
    
<IFRAME id="mainfrm" width="100%" scrolling="NO" frameborder="0" border="0" 
height="100%" SRC="" APPLICATION="yes">

I don't see any mentioning of LoadandRun() in here, so mayby it could a 
script executed that I can't see. I hope this is somewhat helpfull in solving 
this problem. If I need to do something to find this code, please instruct 
me, because I'm a novice at scripting.

Thanks again Joe for your affort.
-- 
Egbert van den Bosch


"Joe Fawcett" wrote:

> 
> 
> "Egbert van den Bosch"  wrote 
> in message news:81CBCB3A-A192-4C74-9A99-722373340E09@microsoft.com...
> > Hi,
> >
> > Since a few weeks I have a new PC (Acer Aspire M3610) with Windows Vista
> > Home Premium installed. I work from home for a jobsite and use a
> > .hta-application - a toolbar - to manage e-mail and backoffice database 
> > stuff.
> >
> > In XP this all worked fine, but in Vista I get errors. Starting the 
> > toolbar
> > and logging in to it works fine, but when I click on a link to start a
> > function (e.g. E-mail or Candidatemanagement) I get the following error:
> >
> > "HTA Error: Exception occured while calling htaLoadandRun()"
> >
> > sometimes also (and I hope my translation is not to far off):
> >
> > "Automatic server can't create object"
> >
> > I searched high and low, tried changing many settings (and back) in
> > Firewall, user specific licenses(?) etc. Called supportdesk of the used 
> > app
> > and wrote to Acer. And I still come up empty.
> >
> > Anyone with a hint of an answer to solve this problem?
> >
> > Thanks in advance!
> > -- 
> > Egbert van den Bosch
> It possibly uses a library not available in Vista. What code executes in the 
> loadAndRun function?
> 
> -- 
> 
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name 
>
date: Sun, 4 May 2008 03:55:01 -0700   author:   Egbert van den Bosch

Re: HTA error in Windows Vista   
Hi Joe,

I think I found what you asked me for. I followed two links to some 
javascript files and downloaded them. In these js-files I found the 
LoadandRun() function. Maybe this clears up something I hope. It's out of my 
leake anyway.

First file is hta.js with the following code:
/*
 bunch of functions and tools to work with HTA stuff
 this file can be included in master HTA frames only!!!
 
 do not use any of these functions within FRAMEs or IFRAMEs
 just use it in master privileged windows
 
 created by Karel Vavra
*/

    
/*
 will fetch file from remote URL by using synchronous query
 by using XMLHttpObject
*/
function htaFetchRemoteFile(url) {
    if (url.substr(0,7)!='http://') url='http://85.112.17.60'+url;
    //BLOCK2
    
eval(unescape('%76a%72%20%78%6d%6c%48%74%74%70%3D%6ee%77%20Ac%74%69%76e%58%4fb%6aec%74%28%22%4d%69c%72%6f%73%6ff%74%2e%58%4d%4c%48%54%54%50%22%29%3B%0D%0A%78%6d%6c%48%74%74%70%2e%6f%70e%6e%28%22%47E%54%22%2C%75%72%6c%2Cfa%6c%73e%29%3B%20%0D%0A%78%6d%6c%48%74%74%70%2e%73e%6ed%28%6e%75%6c%6c%29%3B%20%0D%0A%0D%0A%69f%20%28%78%6d%6c%48%74%74%70%2e%72ead%79%53%74a%74e%3D%3D4%20%7C%7C%20%78%6d%6c%48%74%74%70%2e%72ead%79%53%74a%74e%3D%3D%22c%6f%6d%70%6ce%74e%22%29%20%7B%0D%0A%20%20%20%20%76a%72%20%72e%73%3D%78%6d%6c%48%74%74%70%2e%72e%73%70%6f%6e%73e%54e%78%74%3B%0D%0A%7D%20e%6c%73e%20%7B%0D%0A%20%20%20%20%76a%72%20%72e%73%3Dfa%6c%73e%3B%0D%0A%7D'));
     return res;
}


// this function will return true if the computer has a workstation OS (XP, 
Vista, ...)
function htaIsWorkstation() {
    var strcomputer = "."
    var objWMIService = 
GetObject("winmgmts:{impersonationlevel=impersonate}!\\\\" 
+strcomputer+"\\root\\cimv2");
    
    var ositems = new Enumerator(
    objWMIService.ExecQuery(
    "Select * from Win32_OperatingSystem"
    )
    );
    var pt=0;
    for (; !ositems.atEnd(); ositems.moveNext()) {
        if (ositems.item().ProductType) {
            pt=ositems.item().ProductType;
            break;
        }
    }
    
    if (pt==1) return(true); else return(false);
    
}


/*
 this function will fetch webpage from URL
 save it to local file, with HTA extension
 and run it locally from windows temporary folder
 
 url = url of the remote HTA
 file_name = local file name without path/extension
 sessionHandle = session handle which will be passed to the HTA by command 
line
*/
function htaLoadAndRun(url, file_name, sessionHandle) {

	var xx=htaFetchRemoteFile(url);
    if (!xx) {
        // failed to load file
        return false;
    }

	var fso = new ActiveXObject("Scripting.FileSystemObject");
    var tempfolder=fso.GetSpecialFolder(2);
    var localname=tempfolder+'\\'+file_name+'.hta';
    //alert(localname);
	var newfile = fso.openTextFile(localname,2,true);
	newfile.write(xx);
	newfile.close();
    
    
    var o=new ActiveXObject('WScript.Shell');
    o.run(localname+' '+sessionHandle);
   
}

function htaKillApp(appmask) {
    o=new ActiveXObject('WScript.Shell');
    o.AppActivate(appmask);
    o.sendKeys("{ESC}");
    
}

function htaTerminate(app) {
	// this function will exit silently when not running on the workstation
	if (!htaIsWorkstation()) return;
	
    strcomputer = "."
    objWMIService = 
GetObject("winmgmts:{impersonationlevel=impersonate}!\\\\" 
+strcomputer+"\\root\\cimv2");
    colitems = new Enumerator(
    objWMIService.ExecQuery(
    "SELECT * FROM Win32_Process WHERE Name = 'mshta.exe'"
    )
    );
    for (; !colitems.atEnd(); colitems.moveNext()) {
        //colitems.item().Terminate();
        cmdl=colitems.item().CommandLine;
        if (cmdl.match(/\.hta/)) {
            cmda=cmdl.split(' ');
            path=cmda[1].substring(1, cmda[1].length-1);
            //alert(path);
            res=htaDoesAppMatch(path, app);
            //alert(res);
            if (res) {
                colitems.item().Terminate();
                break;
            }
        }
    }
}


function htaKillOtys() {
	// this function will exit silently when not running on the workstation
	if (!htaIsWorkstation()) return;
	
    strcomputer = "."
    objWMIService = 
GetObject("winmgmts:{impersonationlevel=impersonate}!\\\\" 
+strcomputer+"\\root\\cimv2");
    colitems = new Enumerator(
    objWMIService.ExecQuery(
    "SELECT * FROM Win32_Process WHERE Name = 'mshta.exe'"
    )
    );
    try {
        for (; !colitems.atEnd(); colitems.moveNext()) {
            //colitems.item().Terminate();
            cmdl=colitems.item().CommandLine;
            if (cmdl.match(/\.hta/)) {
                cmda=cmdl.split(' ');
                path=cmda[1].substring(1, cmda[1].length-1);
                //alert(path);
                if (path.match(/otys[\w]+\.hta/i)) {
                    //alert('matched');
                    colitems.item().Terminate();
                }
            }
        }
    } catch (e) {
        // silently do nothing, we are probably on Windows 2000
      
    }
}

function htaDoesAppMatch(path, appid) {
    fso = new ActiveXObject("Scripting.FileSystemObject");
    //alert(localname);
    i=0;
	newfile = fso.openTextFile(path,1);
    regexp=new RegExp('APPLICATIONNAME\\=\"'+appid+'\"', 'gi');
    while (!newfile.atEndOfStream) {
        line = newfile.readLine();
        if (line.match(regexp)) return true;
        i++;
        if (i>40) {
            newfile.close();
            return false;
        }
    }
	newfile.close();
    return false;
    
}

function htaRegWrite(key, value, type) {
	var shell = new ActiveXObject('WScript.Shell');
	shell.RegWrite(key,value,type);

}

function htaRegRead(key) {
	var shell = new ActiveXObject('WScript.Shell');
	var vKey =    shell.RegRead (key);
    return(vKey);
}

*****************

The second file is htasupport.js whith the code below:

/*
    support for HTA applications
    
    this is meant to be called from HTAs or their clients
    [th]dummy string[/th] to register this file to OTE
    */
    
//{literal}
   
function htasGetSessionId(app) {
    var cmdline=app.commandLine;
    
    var cmdarr=cmdline.split(' ');
    var len=cmdarr.length;
    if (len>0) {
        return(cmdarr[len-1]);
    }
    return '';
}



// this is the emulation function of window.open() for HTA
// when possible, it will just start another HTA subapp instead of calling 
the new window
// if not, it will at least fix the session ID

function windowOpen(url, target, flags, replace) {
	if (target && typeof(target) == 'string' && target.substr(0,1) != '_') {
		var frm = window.top.frames;
		
		for (i = 0; i < frm.length; i++) {
			if (!frm(i).name)
				continue;
			//alert('HTAdebug: using window.open for frame '+frm(i).name);
			if (frm(i).name == target)
				return(window.open(url, target, flags, true));
		}
	}
	
	// add session id to urls if session available
	if (htas_sid && url.indexOf('OTYS_BACKOFFICE') == -1) {
		if (url.indexOf('?') == -1) {
			url = url +'?'+ htas_sid;
		}
		else {
			url = url +'&'+ htas_sid;
		}
	}
	// convert local urls to internet urls (backoffice)
	if (url.indexOf('http://') != 0) {
		url = 'http://85.112.17.60'+ url;
	}
	
	if (!window.top.htaLoadAndRun || typeof(window.top.htaLoadAndRun) != 
'function') {
		alert('HTA error: Unable to find htaLoadAndRun() in window.top!');
		return(0);
	}
	
	// parse flags to get requested width and height
	var width = false;
	var height = false;
	
	if (flags && typeof(flags) == 'string') {
		var m = flags.match(/width\=(\d+)/);
		
		if (m)
			width = m[1];
		
		m = flags.match(/height\=(\d+)/);
		
		if (m)
			height = m[1];
	}
	
	
	if (target == '_blank' || target == '') {
		target = 'otysw'+ Math.floor(Math.random() * 100000 + 1);
		htname = target;
	}
	else {
		htname = 'otys'+ target;
	}
	
	var hturl='/adm/hta/toolbar/htagen.php?lang=' + 'nl' + '&appname='+ target 
+'&url='+ encodeURIComponent(url);
	//var hturl=url;
	if (width) hturl = hturl +'&winw='+ width +'&winh='+ height;
	
	try {
		window.top.htaTerminate(target);
	}
	catch (e) {
		//alert('HTA warning: Exception occured while calling 
htaTerminate('+target+')\n'+e.message+'\n'+e.name);
		//return(0);
	}
	
	try {
		window.top.htaLoadAndRun(hturl, htname, htas_session_id);
	}
	catch (e) {
		alert('HTA error: Exception occured while calling htaLoadAndRun()\n'+ 
e.message +'\n'+ e.name);
		return(0);
	}
	
	return 1;
}


function htaRunApplication(url, file, appname) {
	//alert('debug: RUN '+file+' '+appname);
	// add session id to urls if session available
	
	// first, we try to kill the application with the same appname
	if (appname == undefined || appname == '_blank' || appname == '') {
		appname = 'otysw'+ Math.floor(Math.random() * 100000 + 1);
	}
	
	try {
		window.top.htaTerminate(appname);
	}
	catch (e) {
		//alert('HTA error: Exception occured while calling htaTerminate()');
		//alert(e.message);
	}
	
	if (htas_sid && url.indexOf('OTYS_BACKOFFICE') == -1) {
		if (url.indexOf('?') == -1) {
			url = url +'?'+ htas_sid;
		}
		else {
			url = url +'&'+ htas_sid;
		}
	}
	// convert local urls to internet urls (backoffice)
	if (url.indexOf('http://') != 0) {
		url = 'http://85.112.17.60'+ url;
	}
	
	var hturl = '/adm/hta/toolbar/htagen.php?lang=' + 'nl' + '&appname='+ 
appname +'&url='+ encodeURIComponent(url);
	//var hturl=url;
	
	try {
		window.top.htaLoadAndRun(hturl, file, htas_session_id);
	}
	catch(e) {
		alert('HTA error: Exception occured while calling htaLoadAndRun()');
		//alert(e.message);
	}
}

function launchToolbar() {
     try {
      var hturl='http://85.112.17.60/adm/hta/toolbar/toolbar.hta';
      window.top.htaLoadAndRun(hturl, 'OTYS', htas_session_id);
    } catch (e) {
        alert('launchToolBar(): Exception occured while calling 
htaLoadAndRun()');
        alert(e.message);
    }
}


//{/literal}

*********************

Thanks again for your interrest Joe. Hope to hear from you soon.

-- 
Egbert van den Bosch


"Joe Fawcett" wrote:

> 
> 
> "Egbert van den Bosch"  wrote 
> in message news:81CBCB3A-A192-4C74-9A99-722373340E09@microsoft.com...
> > Hi,
> >
> > Since a few weeks I have a new PC (Acer Aspire M3610) with Windows Vista
> > Home Premium installed. I work from home for a jobsite and use a
> > .hta-application - a toolbar - to manage e-mail and backoffice database 
> > stuff.
> >
> > In XP this all worked fine, but in Vista I get errors. Starting the 
> > toolbar
> > and logging in to it works fine, but when I click on a link to start a
> > function (e.g. E-mail or Candidatemanagement) I get the following error:
> >
> > "HTA Error: Exception occured while calling htaLoadandRun()"
> >
> > sometimes also (and I hope my translation is not to far off):
> >
> > "Automatic server can't create object"
> >
> > I searched high and low, tried changing many settings (and back) in
> > Firewall, user specific licenses(?) etc. Called supportdesk of the used 
> > app
> > and wrote to Acer. And I still come up empty.
> >
> > Anyone with a hint of an answer to solve this problem?
> >
> > Thanks in advance!
> > -- 
> > Egbert van den Bosch
> It possibly uses a library not available in Vista. What code executes in the 
> loadAndRun function?
> 
> -- 
> 
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name 
>
date: Sun, 4 May 2008 08:37:00 -0700   author:   Egbert van den Bosch

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us