HTA Window Glue Component

Jun 2, 2005

Fully commented...

<?XML version="1.0"?>
<component>
<?component error="true" debug="true"?>
<comment>-------------------------------------------------------------

'HTA Window Glue' script component (file name: HTAWnGlue.wsc)

Description:

a tacky attempt at persisting 'window settings', to restore
size/position at run time (within available screen space)

Usage:

include a link element inside an HTA element, like so:
<!--

<HTA:APPLICATION APPLICATIONNAME="someUniqueName">
<link style="behavior:url(HTAWnGlue.wsc)">
</HTA:APPLICATION>

-->

(no need for '<!--' these '-->' outside of this file)

Behavior:

*.xml is saved to the 'Application Data' directory (by default), in
a folder entitled 'HTAWnGlueData' the xml files are named/retrieved,
according to each HTA's APPLICATIONNAME value

the HTA's WINDOWSTATE attribute must be kept to its default value of
"normal" for the adhesion behavior to stick, so to speak...

Settings:

there are three 'resource' tags in this component:

"glueDir"
sets the top-level directory, where the data folder
is created; this can be changed in the text of that
tag, for example:
<!--
<resource id="glueDir">C:Temp</resource>
-->
currently that is: 0x1a
(- the shell special folder constant for 'ssfAPPDATA')

"minWidth" and "minHeight"
set minimum dimensions of a window...

Notes:

white-space counts as data in the resource tags

the initial resize can be hidden from view, if a seperate script is
included immediately below the opening <!-- <head> --> tag of
the HTA, like so:
<!--

<script type="text/JScript">
try{moveTo(-32000,-32000)}catch(e){}
</script>

-->
- "normal" WINDOWSTATE is important in this context

all things considered, the component is probably best suited for
resizable HTA's without minimize and maximize buttons...

------------------------------------------------------------</comment>

<implements type="Behavior" id="GlueCode" />

<resource id="glueDir">0x1a</resource>
<resource id="minWidth">100</resource>
<resource id="minHeight">100</resource>

<script language="JScript">
<![CDATA[

GlueCode.attachNotification(function(message)
{
if(message != "documentReady")
return;

var HTA, appName;
if(!((HTA = GlueCode.element.parentElement) && HTA.windowState == "normal" &&
(appName = sysConvention(HTA.applicationName)).length && !external))
return;

var IShellDispatch, IXMLDOMDocument;
if(!((IShellDispatch = AXO("Shell.Application")) &&
(IXMLDOMDocument = AXO(["Msxml2.DOMDocument.4.0","Msxml2.DOMDocument","Microsoft.XMLDOM"]))))
return;

var N, Folder, persist, FolderItem, storageDir = "HTAWnGlueData";
if(!(Folder = IShellDispatch.NameSpace(isNaN(N = +(Folder = attempt(function()
{return getResource("glueDir");}))) ? Folder : N)))
return;

Folder.NewFolder(storageDir);
Folder = IShellDispatch.NameSpace(Folder.Self.Path + "" + storageDir);

var client = document.body, availWidth = screen.availWidth, availHeight = screen.availHeight;

window.attachEvent("onbeforeunload",function()
{
if(!persist)
return;

root = IXMLDOMDocument.documentElement;

root.setAttribute("left", screenLeft);

root.setAttribute("top", screenTop);

root.setAttribute("width", client.offsetWidth);

root.setAttribute("height", client.offsetHeight);

attempt(function(){IXMLDOMDocument.save(IXMLDOMDocument.url || Folder.Self.Path + "" + appName);});
});

IXMLDOMDocument.async = false;

if(!(FolderItem = Folder.ParseName(appName = appName + ".xml")))
{
persist = IXMLDOMDocument.loadXML("<HTAWindow left="" top="" width="" height="" />");
return schedule(function(){
moveTo((availWidth - client.offsetWidth) / 2, (availHeight - client.offsetHeight) / 2);});
}
if(!(persist = IXMLDOMDocument.load(FolderItem.Path)))
return;
var m = 32000;
schedule(function(){moveTo(-m,-m);},function()
{
var
root = IXMLDOMDocument.documentElement,

persistLeft = +root.getAttribute("left"),

persistTop = +root.getAttribute("top"),

persistWidth = +root.getAttribute("width"),

persistHeight = +root.getAttribute("height"),

borderWidth = screenLeft + m,

captionHeight = screenTop + m,

minWidth = (isNaN(minWidth = Math.abs(parseInt(attempt(function()
{return getResource("minWidth")}))))) ? 100 : minWidth,

minHeight = (isNaN(minHeight = Math.abs(parseInt(attempt(function()
{return getResource("minHeight")}))))) ? 100 : minHeight,

size = function()
{resizeTo(Math.max(minWidth, Math.min(availWidth, persistWidth + (borderWidth * 2))),
Math.max(minHeight, Math.min(availHeight, persistHeight + captionHeight + borderWidth)));},

move = function()
{moveTo(Math.max(0, Math.min(persistLeft - borderWidth, availWidth - (client.offsetWidth + (borderWidth * 2)))),
Math.max(0, Math.min(persistTop - captionHeight, availHeight - (client.offsetHeight + captionHeight + borderWidth))));};

schedule(size,function(){schedule(move);});
});

function sysConvention(filename){
var
p1 = /[x00-x1f<"/?*|:>]/g,

p2 = /^[. ]+|[. ]+$/g,

p3 = RegExp("(^AUX$|^CLOCK$$|^COM1$|^COM2$|^COM3$|^COM4$|^COM5$|^COM6$|^COM7$|^COM8$|^COM9$|" +
"^CON$|^LPT1$|^LPT2$|^LPT3$|^LPT4$|^LPT5$|^LPT6$|^LPT7$|^LPT8$|^LPT9$|^NUL$|^PRN$)","i");

return filename.replace(p1,"").replace(p2,"").replace(p3,"$1_");}

function attempt(method,test){
try{throw method();}catch(result){return result instanceof Error ? null : result || test;}}

function schedule(method,next){
!attempt(method,true) ? setTimeout(function(){schedule(method,next);},55) : attempt(next);}

function AXO(progId,loc){
if(!(progId instanceof Array))
return bind(progId);
function bind(pId){
try{
throw loc ? new ActiveXObject(pId,loc) : new ActiveXObject(pId);}
catch(obj){
return obj instanceof Error ? null : obj;}}
var retval, p, i = -1;
while(p = progId[++i])
if(retval = bind(p))
break;
return retval;}
});

]]>
</script>
</component>
Info on script components... http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting091399.asp

HTA:APPLICATION Element: http://msdn.microsoft.com/workshop/author/hta/reference/objects/hta.asp

View 1 Replies


ADVERTISEMENT

JQuery :: Evaluate Component Of AJAX Response After Injecting HTML Component In Page?

Nov 1, 2010

You have an AJAX request and the response is mixed HTML + JavaScript. The javascript is referring to elements in the HTML component. Currently the JavaScript gets evaluated first thing when success is triggered and the HTML is returned as a parameter. Obviously this is not going to work ( in this scenario anyway ). As a previous Mootools user I was used to Request.HTML's responseJavaScript parameter and evalScripts option. None of there options are available in the $.ajax implementation.

P.S. I know I could make the javascript a file and load it separately. I know I can make my response JSON and have the js and html in separate properties of the JSON object. I want neither.

View 4 Replies View Related

Greasemonkey 'Component Is Not Available'

Dec 27, 2006

I'm new to Greasemonkey, and have no idea how to fix this. I would post elsewhere, but I couldn't find a forum for user script development help....

View 4 Replies View Related

JQuery :: Datepicker Component Not Selected?

Sep 20, 2011

I am newly using Jquery. I have a script here like :

[Code]...

This opens up a text box which when clicked, my date picker will pop up. If clicked elsewhere it will disappear again. But I might have done something wrong, as presently this is not happening.

View 2 Replies View Related

JQuery :: Dynamically Set Position For A Component?

Jul 15, 2010

I am trying to build this interface where there are icons and onmouseover, it displays menu choices for the corresponding. Instead of fixing the position of the menu box, is there a way to specify the left and top of that, relative to the icon that is being hovered? Here is part of my code:

<table width="100%" style="">
<tr align="center">
<td>
<img id="imgHead1" src="images/ccd.ico" alt="Info Center"

[Code]....

View 2 Replies View Related

Firebug: Component.singularize Is Not A Function

Sep 17, 2010

Firebug gives me the below error message:

component.singularize is not a function [Break on this error] var component = component.singularize();

This is what I have:

var component = window.location.hash.replace('#', '');
var component = component.singularize();
alert("The component name is " + component);

[Code]....

View 6 Replies View Related

JQuery :: Picking The Order Of Images In A Component?

Jun 22, 2010

I have a problem. I have a div component where I'll drag multiple images. This part is working perfectly. But I am not able to read the order of these images played in the component. What happens, I can play any position in the image of the div component, however, like to read in order as they are, from left to right.

I believe it is possible, but the solution must be complicated. Some of his friends could help me in the routine javascript to read this?

[Code]...

View 4 Replies View Related

JQuery :: How To Reload Component (Second Selected Item)

Mar 9, 2010

I got a page with 2 <select> the second one is populated by the 1st selected item. I want to know how can I reload just the second <select>.

View 2 Replies View Related

Background Image Gone After Adding JS Component / Get That Back?

Nov 16, 2010

Am just starting a new site and this morning noticed my header background image (logo) was missing.

Started out with normal CSS/HTML navigation menu.

www.westernwebdesign.com.au/pelican/index.html

Then I added a Vista buttons navigation menu:

http://www.westernwebdesign.com.au/p...cal/index.html

and the logo was gone. Not exactly sure at what point it disappeared yesterday as I didn't notice it missing until this morning. The navigation is about the only point of difference so I think this is the issue but have no idea why.

View 3 Replies View Related

Building A Horizontal Slider/menu Component?

Sep 8, 2011

building an HTML/CSS component that would:

1) Feature a small set of icons that would be placed on the right-side of a div

2) If someone clicked on one of the icons, the component would slide out towards the right, featuring various UI elements (i.e. descriptive text and form elements). The component slides out to match the width of the content (not fixed width)

3) The slider slides back if the user clicks on the "X" in top right corner or moves their mouse/clicks outside the slider area.

4) A nice to have would be if the component is towards the right side of the screen, the component slides out left (so it does not go outside the screen area or show a horizontal slider on the bottom of the screen window).

A visual of what I am trying to accomplish can be found in the attached file.

View 1 Replies View Related

Register And Host ActiveX Component In Windows / Internet Explorer

Jul 15, 2007

I have made a ActiveX control for commericial application. A Drag and
Drop component for Mail server.

I need to host the component in Internet Explorer.

When a user opens a mail it should prompt the user to download and
register the Drag and Drop activeX component.

This should be a trivial program. Please let me know how is it done.

View 1 Replies View Related

Advanced DHTML Dropdown List Component With Autofilter Feature

Jul 20, 2005

Advanced DHTML Dropdown List component (Javascript,ASP,.NET,PHP)
enhances usability of large dropdown lists with type & select feature.
It suggests possible matches for entries you type in the input box.
Works in all browser with DIV, CSS and JavaScript support: IE5+,
Netscape6+, Mozilla, Opera. The script allows full customization with
style sheets, single and multiple select mode. Code:

View 2 Replies View Related

Script Or List Component That Allow To Change Order By Drag & Drop?

Jan 4, 2010

looking for a script or list component that allow to change order by drag & drop

View 2 Replies View Related

JQuery :: Good Web UI Component Libraries - Cross Browser Compatible And Have Good Documentation

May 10, 2009

Are there any good web UI component libraries -open source or commercial - that you can recomment? They need to be cross browser compatible and have good documentation. Jquery UI is very good but limited in number of controls it offers. YUI is very verbose and very hard to use. extJs only other one I can think of. Any others you use and like?

View 2 Replies View Related

Uncaught Exception: Exception... "Component Returned Failure Code: 0x80004003

Sep 23, 2009

I am needing some help with an error I'm getting from a project I'm working on. First off let me preface this all with the fact that I'm a total javascript noob. I'm really trying to understand what I'm doing wrong. So any help or advice is MORE than welcome. Here's what is happening. I found this code that will duplicate a row in a table and modifiy the name of a input in the row. Well for my purposes I have two different tables I need to work with. (each one idividually) So I changed the code a bit to make it accecpt a variable to use for the table name. (before it was static) and now I'm getting a error. Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER)" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://www.tourandtravelnow.com/admin/scripts/faxPageScript.js :: addRow :: line 14" data: no] This is the old code that would work (only for one of the tables)

[Code]...

View 1 Replies View Related

Cross Browser Compatibility - Error: Uncaught Exception: [Exception... "Component Returned Failure"

Jan 10, 2009

I am having trouble getting my expanding menu to work in Firefox and Opera. It works fine in IE though. I did not write the javascript myself, as I am fairly new to JS, but I did all the HTML and CSS. I used the error console on FF, and also used FireBug. They both returned the following error:

[Code]...

View 23 Replies View Related

Child Window Close Event - Opening Another Link In A Separate Window Using Window.open()

Jan 29, 2010

I have a HTML and I am opening another link in a separate window using window.open() . The child window is something like 'http://yahoo.com' which is out side html. I need to refresh the parent window when the child window is closed.

View 4 Replies View Related

WEB Site Opens An Application Window And Then, From Its Original Window It Navigates To A Status Page?

May 11, 2011

My WEB site opens an application window and then, from its original window it navigates to a status page.

Code:
var newWindow
function popUpApplication() {

[code]...

View 5 Replies View Related

Automaticaly Clsoe The Parent Window When The Child Window Opened In Firefox?

Mar 24, 2011

i have this code i need to close the parent.html window when the child window opened, i need the code for that working well in IE and Firefox Parent.html

<HTML>
<SCRIPT TYPE="text/javascript">
function sendTo()
{
window.open('child.html','_blank','resizable=yes,width='+(screen.width-500)+',height='+(screen.height-500)+'');
}
[Code]...

View 2 Replies View Related

Script To Close Old Window And Open New Window With New Link And Specific Size

Jan 29, 2006

I need a script that will open a new window (popup / new link) in a specific size, but will also close the old window (where the popup came from). I know the popup window is easy but finding a work-able close window script as the new window is opened is impossible!!

View 3 Replies View Related

Form Opening In The Main Window/ Simeltaneiously Closes Popup Window

Jan 8, 2004

I have a popup window which has the search form in. What I want to do is for the popup window to close once the form is submitted, and to post the form data to a page on the main window.

Is anyone able to advise. As the main page is dynamic, it is not possible to give the page a name.

View 4 Replies View Related

Window.opener Either Blocks When I Referesh The Parent Page Or Opens In New Window?

Aug 11, 2011

I am trying to usw window.open , upload a file in the child window and then referesh the parent window. But once upload is done, window . opener .location.href or opener.location.replace sends a message back but I get a pop up blocker, so if I turn pop up blocker off, it opens in new page. I just want the parent page to refresh on the same window. This works on some employees stations but not on others..I don't know if there are any settings on IE that need to change, I tried everything...weird. does any one done this before?

View 1 Replies View Related

Child Pop Up Race Condition Using Window.open Need To Detect Window.onload

Nov 22, 2011

I am trying to pop up a window and then do stuff(set flags) when the content of the new window is done loading. For this I am trying to detect the window.onload of the pop-up child window but so far I am unsuccessful. I believe my problem is that the URL of child window is on different domain, than the one of the opener(parent) so that the window.onload is not being called. Though this may change, at the moment I do not have access to the code for the page I'm opening up in the pop-up. Im pretty new to web development.

[Code]....

View 3 Replies View Related

Window.resizeTo() Inside A Window.onResize Event Handler Function?

Apr 23, 2011

I want to preserve a 16/9 aspect ratio to the window after any resize, making the width a function of the height.

As I have a window.resizeTo() inside the window.onresize event function, the infinite loop is served. How may I quit it?

<html><head><title>Title</title><script languaje="javascript">
const c_ra=16/9;
window.onresize = function WindowReSize() {
var myWidth = 0, myHeight = 0;

[Code].....

View 2 Replies View Related

JQuery :: Create A Hidden Form Field In A Parent Window From Within A Child Window - Popup

Jun 13, 2011

Im trying to create a hidden form field in a parent window from within a child window (popup). I am trying to use jQuery, but unfortunately the hidden field does not get created.

Code JavaScript:

View 2 Replies View Related

Trouble Retrieving Window Location From A Previously Opened Window ?

Dec 24, 2005

I am trying to open up a new window and then get the current url/location
back from the (win_1) window and display the url in an alert box.

Here is the code I am using :-

<script type="text/javascript">
var mywin_1 = open ("http://www.anysite.com/index.htm", "win_1",
"height=640, width=820, left=200, top=0, scrollbars, status, location");
var temp = mywin_1.location;
alert (temp);
</script>

Where am I going wrong?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved